staging: unisys: visorbus: add error handling to toolaction_show
authorDavid Kershner <david.kershner@unisys.com>
Tue, 28 Mar 2017 13:34:23 +0000 (09:34 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Mar 2017 07:17:02 +0000 (09:17 +0200)
Don't just drop the error from visorchannel_read on the floor, report it.

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/visorchipset.c

index cb8c6f946c960a1119f0e46617cad08fc16bd5e0..543218f11e0a12e28cdec9621addfdc60130f0fc 100644 (file)
@@ -91,10 +91,15 @@ static ssize_t toolaction_show(struct device *dev,
                               char *buf)
 {
        u8 tool_action = 0;
+       int err;
+
+       err = visorchannel_read(chipset_dev->controlvm_channel,
+                               offsetof(struct spar_controlvm_channel_protocol,
+                                        tool_action),
+                               &tool_action, sizeof(u8));
+       if (err)
+               return err;
 
-       visorchannel_read(chipset_dev->controlvm_channel,
-                         offsetof(struct spar_controlvm_channel_protocol,
-                                  tool_action), &tool_action, sizeof(u8));
        return sprintf(buf, "%u\n", tool_action);
 }