On Wed, Jan 28, 2015 at 02:15:36PM +0800, Junjie Mao wrote: > Use goto labels for all failure paths in edac_create_sysfs_mci_device. > > Signed-off-by: Junjie Mao <junjie_...@yeah.net> > --- > drivers/edac/edac_mc_sysfs.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c > index 670d2829c547..16f3720f9b73 100644 > --- a/drivers/edac/edac_mc_sysfs.c > +++ b/drivers/edac/edac_mc_sysfs.c > @@ -989,7 +989,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) > > err = bus_register(mci->bus); > if (err < 0) > - return err; > + goto fail_free_name; > > /* get the /sys/devices/system/edac subsys reference */ > mci->dev.type = &mci_attr_type; > @@ -1005,9 +1005,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info > *mci) > err = device_add(&mci->dev); > if (err < 0) { > edac_dbg(1, "failure: create device %s\n", dev_name(&mci->dev)); > - bus_unregister(mci->bus); > - kfree(mci->bus->name); > - return err; > + goto fail_unregister_bus; > } > > if (mci->set_sdram_scrub_rate || mci->get_sdram_scrub_rate) { > @@ -1072,7 +1070,9 @@ fail: > } > fail2:
Looks ok. Can you please change those nothing-telling label names "fail" and "fail2" into something more descriptive, while you're at it? > device_unregister(&mci->dev); > +fail_unregister_bus: > bus_unregister(mci->bus); > +fail_free_name: > kfree(mci->bus->name); > return err; Thanks. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/