USB: storage: ums-realtek: fix error code in rts51x_read_mem()
Subsystems (3)
PATCH 1/1 USB: storage: ums-realtek: fix error code in rts51x_read_mem()
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 065e60964e29 ("ums_realtek: do not use stack memory for DMA")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/usb/storage/realtek_cr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/storage/realtek_cr.c +1 -1
@@ -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);
Signature · 1 line
2.20.1
Quoted 7 lines · Dan Carpenter
The
rts51x_read_mem()function should return negative error codes. Currently if thekmalloc()fails it returnsUSB_STOR_TRANSPORT_ERROR(3) which is treated as success by the callers.Fixes 065e60964e29 ("ums_realtek: do not use stack memory for DMA")Signed-off-by Dan Carpenter <[email protected]>---
Acked-by Alan Stern <[email protected]>
Quoted 19 lines
drivers/usb/storage/realtek_cr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/storage/realtek_cr.c +1
-1@@ -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);Signature · 1 line
2.20.1