[PATCH v0] USB: storage: karma: fix rio_karma_init return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The function rio_karam_init() should return USB_STOR_TRANSPORT_ERROR
instead of 0 (USB_STOR_TRANSPORT_GOOD) when allocation fails.

Fixes: dfe0d3ba20e8 ("USB Storage: add rio karma eject support")

Signed-off-by: Lin Ma <linma@xxxxxxxxxx>
---
 drivers/usb/storage/karma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c
index 05cec81dcd3f..b8a4ae1aa22a 100644
--- a/drivers/usb/storage/karma.c
+++ b/drivers/usb/storage/karma.c
@@ -178,19 +178,19 @@ static int rio_karma_init(struct us_data *us)
 	struct karma_data *data = kzalloc(sizeof(struct karma_data), GFP_NOIO);
 
 	if (!data)
-		goto out;
+		return USB_STOR_TRANSPORT_ERROR;
 
 	data->recv = kmalloc(RIO_RECV_LEN, GFP_NOIO);
 	if (!data->recv) {
 		kfree(data);
-		goto out;
+		return USB_STOR_TRANSPORT_ERROR;
 	}
 
 	us->extra = data;
 	us->extra_destructor = rio_karma_destructor;
 	ret = rio_karma_send_command(RIO_ENTER_STORAGE, us);
 	data->in_storage = (ret == 0);
-out:
+
 	return ret;
 }
 
-- 
2.35.1




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux