Skip to content

Commit

Permalink
wusb: fix error path for wusb_set_dev_addr()
Browse files Browse the repository at this point in the history
Error path for wusb_set_dev_addr() was handled incorrectly. Fix it by
considering error only when return value is negative.

Signed-off-by: Anderson Lizardo <anderson.lizardo@indt.org.br>
Signed-off-by: David Vrabel <david.vrabel@csr.com>
  • Loading branch information
Anderson Lizardo authored and David Vrabel committed Sep 17, 2008
1 parent d09318b commit f51c23b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/usb/wusbcore/devconnect.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
"port %u\n", dev_addr, port_idx);

result = wusb_set_dev_addr(wusbhc, wusb_dev, dev_addr);
if (result)
return NULL;
if (result < 0)
return NULL;
}
wusb_dev->entry_ts = jiffies;
list_add_tail(&wusb_dev->cack_node, &wusbhc->cack_list);
Expand Down Expand Up @@ -1301,7 +1301,7 @@ int wusb_set_dev_addr(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev, u8 addr)

wusb_dev->addr = addr;
result = wusbhc->dev_info_set(wusbhc, wusb_dev);
if (result)
if (result < 0)
dev_err(wusbhc->dev, "device %d: failed to set device "
"address\n", wusb_dev->port_idx);
else
Expand Down

0 comments on commit f51c23b

Please sign in to comment.