From: Prameela Rani Garnepudi Date: Tue, 16 May 2017 10:01:12 +0000 (+0530) Subject: rsi: Handle usb multi-byte write failure case properly X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=ea3336ac0094b9d461fdde22127087ee293e609a;p=openwrt%2Fstaging%2Fblogic.git rsi: Handle usb multi-byte write failure case properly 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 Signed-off-by: Amitkumar Karwar Signed-off-by: Kalle Valo --- diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c index 9e1359a204fc..a900a7288acb 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -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);