rsi: Handle usb multi-byte write failure case properly
authorPrameela Rani Garnepudi <prameela.j04cs@gmail.com>
Tue, 16 May 2017 10:01:12 +0000 (15:31 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 24 May 2017 13:37:50 +0000 (16:37 +0300)
In function usb_write_register_multiple, if any intermediate block transfer
is failed, further operations should be terminated. 'else' is removed, as
there is no significance for it after return.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rsi/rsi_91x_usb.c

index 9e1359a204fcda12407d88f0b59deeaa9dd376af..a900a7288acb7fe18c437b99b7a8bcd95f324669 100644 (file)
@@ -316,11 +316,12 @@ int rsi_usb_write_register_multiple(struct rsi_hw *adapter,
                        rsi_dbg(ERR_ZONE,
                                "Reg write failed with error code :%d\n",
                                status);
-               } else {
-                       count -= transfer;
-                       data += transfer;
-                       addr += transfer;
+                       kfree(buf);
+                       return status;
                }
+               count -= transfer;
+               data += transfer;
+               addr += transfer;
        }
 
        kfree(buf);