Skip to content

Commit

Permalink
[S390] cio: channel path memory leak
Browse files Browse the repository at this point in the history
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: Michael Ernst <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
  • Loading branch information
Michael Ernst authored and Martin Schwidefsky committed Oct 6, 2009
1 parent 6a03f5f commit ec00440
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/s390/cio/chp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit ec00440

Please sign in to comment.