diff options
author | David Kershner <david.kershner@unisys.com> | 2017-03-28 09:34:45 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-29 09:17:03 +0200 |
commit | 362f87f3122d1f744bb09caa40e86fae5d9f4c60 (patch) | |
tree | 34a73ab3c523dac7218528f57787531ac1ca281e /drivers/staging/unisys | |
parent | 5dca9b294436eb381b825f60751723e80173cb4b (diff) |
staging: unisys: visorbus: fix error handling in create_bus_instance
The function get_vbus_header_info returns errors that were being handled
incorrectly. Fix the error handling in create_bus_instance.
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Reviewed-by: Tim Sell <timothy.sell@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 | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index bf0f191e79d3..3e756ca1e449 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1023,46 +1023,35 @@ create_bus_instance(struct visor_device *dev) dev->debugfs_dir = debugfs_create_dir(dev_name(&dev->device), visorbus_debugfs_dir); - if (!dev->debugfs_dir) { - err = -ENOMEM; - goto err_hdr_info; - } dev->debugfs_client_bus_info = debugfs_create_file("client_bus_info", 0440, dev->debugfs_dir, dev, &client_bus_info_debugfs_fops); - if (!dev->debugfs_client_bus_info) { - err = -ENOMEM; + + dev_set_drvdata(&dev->device, dev); + err = get_vbus_header_info(dev->visorchannel, hdr_info); + if (err < 0) goto err_debugfs_dir; - } - if (device_register(&dev->device) < 0) { + err = device_register(&dev->device); + if (err < 0) { POSTCODE_LINUX(DEVICE_CREATE_FAILURE_PC, 0, id, DIAG_SEVERITY_ERR); - err = -ENODEV; - goto err_debugfs_created; + goto err_debugfs_dir; } - if (get_vbus_header_info(dev->visorchannel, hdr_info) >= 0) { - dev->vbus_hdr_info = (void *)hdr_info; - write_vbus_chp_info(dev->visorchannel, hdr_info, - &chipset_driverinfo); - write_vbus_bus_info(dev->visorchannel, hdr_info, - &clientbus_driverinfo); - } else { - kfree(hdr_info); - } list_add_tail(&dev->list_all, &list_all_bus_instances); - dev_set_drvdata(&dev->device, dev); - return 0; -err_debugfs_created: - debugfs_remove(dev->debugfs_client_bus_info); + dev->vbus_hdr_info = (void *)hdr_info; + write_vbus_chp_info(dev->visorchannel, hdr_info, + &chipset_driverinfo); + write_vbus_bus_info(dev->visorchannel, hdr_info, + &clientbus_driverinfo); + + return 0; err_debugfs_dir: debugfs_remove_recursive(dev->debugfs_dir); - -err_hdr_info: kfree(hdr_info); return err; } |