Skip to content

Commit

Permalink
USB: storage: ums-realtek: fix error code in rts51x_read_mem()
Browse files Browse the repository at this point in the history
[ Upstream commit b07cabb ]

The rts51x_read_mem() function should return negative error codes.
Currently if the kmalloc() fails it returns USB_STOR_TRANSPORT_ERROR (3)
which is treated as success by the callers.

Fixes: 065e609 ("ums_realtek: do not use stack memory for DMA")
Acked-by: Alan Stern <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
Link: https://lore.kernel.org/r/20220304073504.GA26464@kili
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Dan Carpenter authored and Sasha Levin committed Apr 6, 2022
1 parent 8408c2f commit 84c324e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/storage/realtek_cr.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len)

buf = kmalloc(len, GFP_NOIO);
if (buf == NULL)
return USB_STOR_TRANSPORT_ERROR;
return -ENOMEM;

usb_stor_dbg(us, "addr = 0x%x, len = %d\n", addr, len);

Expand Down

0 comments on commit 84c324e

Please sign in to comment.