Skip to content

Commit

Permalink
usb: udc-uclass: Fixed problem when no alias is defined in DT
Browse files Browse the repository at this point in the history
commit 801f1fa "dm: usb: udc: Use SEQ_ALIAS to index the USB gadget
ports" changed the way the udevice if found. It uses the alias to find
a udevice for a given USB port number. In the commit log it was stated
that if no alias is provided, the bind order will be used instead. However
it doesn't work. Fixing this by adding a call to uclass_get_device() if
uclass_get_device_by_seq() fails.

Signed-off-by: Jean-Jacques Hiblot <[email protected]>
Tested-by: Vignesh R <[email protected]>
  • Loading branch information
Jean-Jacques Hiblot authored and Marek Vasut committed Mar 16, 2019
1 parent 731785d commit e81d9de
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/usb/gadget/udc/udc-uclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ int usb_gadget_initialize(int index)
return 0;
ret = uclass_get_device_by_seq(UCLASS_USB_GADGET_GENERIC, index, &dev);
if (!dev || ret) {
pr_err("No USB device found\n");
return -ENODEV;
ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, index, &dev);
if (!dev || ret) {
pr_err("No USB device found\n");
return -ENODEV;
}
}
dev_array[index] = dev;
return 0;
Expand Down

0 comments on commit e81d9de

Please sign in to comment.