]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: unisys: visorbus: add error handling to chipset_bus_create
authorDavid Kershner <david.kershner@unisys.com>
Tue, 28 Mar 2017 13:34:35 +0000 (09:34 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Mar 2017 07:17:02 +0000 (09:17 +0200)
The function chipset_bus_create should return an error. If an error
is returned, it is assumed the response has not been sent by bus_create.

Correctly handle when the error has been returned in visorchipset.

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>
drivers/staging/unisys/visorbus/visorbus_main.c
drivers/staging/unisys/visorbus/visorbus_private.h
drivers/staging/unisys/visorbus/visorchipset.c

index b99adaaeee153098c01d0228fe9bad2a4283c16e..87fb343f28a3c7ffdfc0e5c6aa2840246ec0e71a 100644 (file)
@@ -1090,24 +1090,25 @@ remove_all_visor_devices(void)
        }
 }
 
-void
+int
 chipset_bus_create(struct visor_device *dev)
 {
-       int rc;
+       int err;
        u32 bus_no = dev->chipset_bus_no;
 
        POSTCODE_LINUX(BUS_CREATE_ENTRY_PC, 0, bus_no, DIAG_SEVERITY_PRINT);
-       rc = create_bus_instance(dev);
+       err = create_bus_instance(dev);
        POSTCODE_LINUX(BUS_CREATE_EXIT_PC, 0, bus_no, DIAG_SEVERITY_PRINT);
 
-       if (rc < 0)
+       if (err < 0) {
                POSTCODE_LINUX(BUS_CREATE_FAILURE_PC, 0, bus_no,
                               DIAG_SEVERITY_ERR);
-       else
-               POSTCODE_LINUX(CHIPSET_INIT_SUCCESS_PC, 0, bus_no,
-                              DIAG_SEVERITY_PRINT);
+               return err;
+       }
 
-       bus_create_response(dev, rc);
+       bus_create_response(dev, err);
+
+       return 0;
 }
 
 void
index fdccfcb0d1b13983201729dde6853490715de432..597c2dea3c51ba67e9b84b7d80fbb3c733d09132 100644 (file)
@@ -27,7 +27,7 @@
  * command line
  */
 
-void chipset_bus_create(struct visor_device *bus_info);
+int chipset_bus_create(struct visor_device *bus_info);
 void chipset_bus_destroy(struct visor_device *bus_info);
 void chipset_device_create(struct visor_device *dev_info);
 void chipset_device_destroy(struct visor_device *dev_info);
index d617ba1445ab5fb1da42f353991a5ee33bd1adc6..d7ddf55f97c1e471572828b7de966b3be4c6c6d2 100644 (file)
@@ -656,11 +656,17 @@ bus_create(struct controlvm_message *inmsg)
        bus_info->visorchannel = visorchannel;
 
        /* Response will be handled by chipset_bus_create */
-       chipset_bus_create(bus_info);
+       err = chipset_bus_create(bus_info);
+       /* If error chipset_bus_create didn't respond, need to respond here */
+       if (err)
+               goto err_destroy_channel;
 
        POSTCODE_LINUX(BUS_CREATE_EXIT_PC, 0, bus_no, DIAG_SEVERITY_PRINT);
        return 0;
 
+err_destroy_channel:
+       visorchannel_destroy(visorchannel);
+
 err_free_pending_msg:
        kfree(bus_info->pending_msg_hdr);