Commit 644110e1 authored by Robert Richter's avatar Robert Richter Committed by Borislav Petkov

EDAC/mc_sysfs: Remove pointless gotos

Use direct returns instead of gotos. Error handling code becomes
smaller and better readable.
Signed-off-by: default avatarRobert Richter <rrichter@marvell.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Tony Luck <tony.luck@intel.com>
Link: https://lkml.kernel.org/r/20190902123216.9809-4-rrichter@marvell.com
parent d55c79ac
...@@ -938,7 +938,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci, ...@@ -938,7 +938,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci,
if (err < 0) { if (err < 0) {
edac_dbg(1, "failure: create device %s\n", dev_name(&mci->dev)); edac_dbg(1, "failure: create device %s\n", dev_name(&mci->dev));
put_device(&mci->dev); put_device(&mci->dev);
goto out; return err;
} }
/* /*
...@@ -987,7 +987,6 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci, ...@@ -987,7 +987,6 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci,
} }
device_unregister(&mci->dev); device_unregister(&mci->dev);
out:
return err; return err;
} }
...@@ -1044,10 +1043,8 @@ int __init edac_mc_sysfs_init(void) ...@@ -1044,10 +1043,8 @@ int __init edac_mc_sysfs_init(void)
int err; int err;
mci_pdev = kzalloc(sizeof(*mci_pdev), GFP_KERNEL); mci_pdev = kzalloc(sizeof(*mci_pdev), GFP_KERNEL);
if (!mci_pdev) { if (!mci_pdev)
err = -ENOMEM; return -ENOMEM;
goto out;
}
mci_pdev->bus = edac_get_sysfs_subsys(); mci_pdev->bus = edac_get_sysfs_subsys();
mci_pdev->type = &mc_attr_type; mci_pdev->type = &mc_attr_type;
...@@ -1055,17 +1052,14 @@ int __init edac_mc_sysfs_init(void) ...@@ -1055,17 +1052,14 @@ int __init edac_mc_sysfs_init(void)
dev_set_name(mci_pdev, "mc"); dev_set_name(mci_pdev, "mc");
err = device_add(mci_pdev); err = device_add(mci_pdev);
if (err < 0) if (err < 0) {
goto out_put_device; put_device(mci_pdev);
return err;
}
edac_dbg(0, "device %s created\n", dev_name(mci_pdev)); edac_dbg(0, "device %s created\n", dev_name(mci_pdev));
return 0; return 0;
out_put_device:
put_device(mci_pdev);
out:
return err;
} }
void edac_mc_sysfs_exit(void) void edac_mc_sysfs_exit(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment