提交 ec004407 编写于 作者: M Michael Ernst 提交者: Martin Schwidefsky

[S390] cio: channel path memory leak

Move dev_set_name to when we know that the device will actually be
registered in order to avoid a memory leak if the allocated memory
for the channel path has to be freed.
Signed-off-by: NMichael Ernst <mernst@de.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 6a03f5f0
......@@ -393,7 +393,6 @@ int chp_new(struct chp_id chpid)
chp->state = 1;
chp->dev.parent = &channel_subsystems[chpid.cssid]->device;
chp->dev.release = chp_release;
dev_set_name(&chp->dev, "chp%x.%02x", chpid.cssid, chpid.id);
/* Obtain channel path description and fill it in. */
ret = chsc_determine_base_channel_path_desc(chpid, &chp->desc);
......@@ -411,6 +410,7 @@ int chp_new(struct chp_id chpid)
} else {
chp->cmg = -1;
}
dev_set_name(&chp->dev, "chp%x.%02x", chpid.cssid, chpid.id);
/* make it known to the system */
ret = device_register(&chp->dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册