diff mbox series

rsi: fix error code in rsi_load_9116_firmware()

Message ID 20210805103746.GA26417@kili (mailing list archive)
State Accepted
Commit d0f8430332a16c7baa80ce2886339182c5d85f37
Delegated to: Kalle Valo
Headers show
Series rsi: fix error code in rsi_load_9116_firmware() | expand

Commit Message

Dan Carpenter Aug. 5, 2021, 10:37 a.m. UTC
This code returns success if the kmemdup() fails, but obviously it
should return -ENOMEM instead.

Fixes: e5a1ecc97e5f ("rsi: add firmware loading for 9116 device")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/wireless/rsi/rsi_91x_hal.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Kalle Valo Aug. 21, 2021, 5:27 p.m. UTC | #1
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> This code returns success if the kmemdup() fails, but obviously it
> should return -ENOMEM instead.
> 
> Fixes: e5a1ecc97e5f ("rsi: add firmware loading for 9116 device")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied to wireless-drivers-next.git, thanks.

d0f8430332a1 rsi: fix error code in rsi_load_9116_firmware()
diff mbox series

Patch

diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c
index 99b21a2c8386..f4a26f16f00f 100644
--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -1038,8 +1038,10 @@  static int rsi_load_9116_firmware(struct rsi_hw *adapter)
 	}
 
 	ta_firmware = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
-	if (!ta_firmware)
+	if (!ta_firmware) {
+		status = -ENOMEM;
 		goto fail_release_fw;
+	}
 	fw_p = ta_firmware;
 	instructions_sz = fw_entry->size;
 	rsi_dbg(INFO_ZONE, "FW Length = %d bytes\n", instructions_sz);