Commit 92d5e245 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Kalle Valo

rt2x00usb: check USB's request error code in rt2800usb_autorun_detect()

rt2800usb_autorun_detect() blindly assumes assumes that it worked while
it could have failed. Check the error code here.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent e4fcfaf8
...@@ -233,6 +233,7 @@ static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) ...@@ -233,6 +233,7 @@ static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev)
{ {
__le32 *reg; __le32 *reg;
u32 fw_mode; u32 fw_mode;
int ret;
reg = kmalloc(sizeof(*reg), GFP_KERNEL); reg = kmalloc(sizeof(*reg), GFP_KERNEL);
if (reg == NULL) if (reg == NULL)
...@@ -242,11 +243,14 @@ static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) ...@@ -242,11 +243,14 @@ static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev)
* magic value USB_MODE_AUTORUN (0x11) to the device, thus the * magic value USB_MODE_AUTORUN (0x11) to the device, thus the
* returned value would be invalid. * returned value would be invalid.
*/ */
rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE, ret = rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE,
USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN, USB_VENDOR_REQUEST_IN, 0,
reg, sizeof(*reg), REGISTER_TIMEOUT_FIRMWARE); USB_MODE_AUTORUN, reg, sizeof(*reg),
REGISTER_TIMEOUT_FIRMWARE);
fw_mode = le32_to_cpu(*reg); fw_mode = le32_to_cpu(*reg);
kfree(reg); kfree(reg);
if (ret < 0)
return ret;
if ((fw_mode & 0x00000003) == 2) if ((fw_mode & 0x00000003) == 2)
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment