diff options
author | Benjamin Romer <benjamin.romer@unisys.com> | 2016-02-23 10:01:52 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-25 22:40:52 -0800 |
commit | c2c667d6bd78794bc3ee63939786caafe2169a4b (patch) | |
tree | 77df370940e95142d9d09ff089ad68b4f3dd4c9e /drivers/staging/unisys | |
parent | f99d3308c5490c3bf72a7d4929bb76443daa2097 (diff) |
staging: unisys: get rid of goto in create_bus_instance()
Remove the unnecessary rc and goto messiness, and just handle freeing
the memory before returning an error in the one place where that needs
to happen.
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/unisys')
-rw-r--r-- | drivers/staging/unisys/visorbus/visorbus_main.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index f81da4d2e657..59cef7779a2d 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1197,17 +1197,14 @@ fix_vbus_dev_info(struct visor_device *visordev) static int create_bus_instance(struct visor_device *dev) { - int rc; int id = dev->chipset_bus_no; struct spar_vbus_headerinfo *hdr_info; POSTCODE_LINUX_2(BUS_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); hdr_info = kzalloc(sizeof(*hdr_info), GFP_KERNEL); - if (!hdr_info) { - rc = -1; - goto away; - } + if (!hdr_info) + return -ENOMEM; dev_set_name(&dev->device, "visorbus%d", id); dev->device.bus = &visorbus_type; @@ -1217,8 +1214,8 @@ create_bus_instance(struct visor_device *dev) if (device_register(&dev->device) < 0) { POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, id, POSTCODE_SEVERITY_ERR); - rc = -1; - goto away_mem; + kfree(hdr_info); + return -ENODEV; } if (get_vbus_header_info(dev->visorchannel, hdr_info) >= 0) { @@ -1234,11 +1231,6 @@ create_bus_instance(struct visor_device *dev) list_add_tail(&dev->list_all, &list_all_bus_instances); dev_set_drvdata(&dev->device, dev); return 0; - -away_mem: - kfree(hdr_info); -away: - return rc; } /** Remove a device instance for the visor bus itself. |