USB: HWA: fix device probe failure
This patch fixes a race condition that caused the HWA_HC interface probe function to occasionally fail. The HWA_HC would attempt to register itself with the HWA_RC by searching for a uwb_rc class device with the same parent device ptr. If the probe function for the HWA_RC interface had yet to run, the uwb_rc class device would not have been created causing the look up to fail and the HWA_HC probe function to return an error causing the device to be unusable. The fix is for the HWA to delay registering with the HWA_RC until receiving the command from userspace to start the wireless channel. It is the responsibility of userspace to ensure that the uwb_rc class device has been created before starting the HWA channel. Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
6e6581e0a9
commit
a899575191
@@ -683,12 +683,9 @@ static int hwahc_create(struct hwahc *hwahc, struct usb_interface *iface)
|
||||
wa->usb_dev = usb_get_dev(usb_dev); /* bind the USB device */
|
||||
wa->usb_iface = usb_get_intf(iface);
|
||||
wusbhc->dev = dev;
|
||||
wusbhc->uwb_rc = uwb_rc_get_by_grandpa(iface->dev.parent);
|
||||
if (wusbhc->uwb_rc == NULL) {
|
||||
result = -ENODEV;
|
||||
dev_err(dev, "Cannot get associated UWB Host Controller\n");
|
||||
goto error_rc_get;
|
||||
}
|
||||
/* defer getting the uwb_rc handle until it is needed since it
|
||||
* may not have been registered by the hwa_rc driver yet. */
|
||||
wusbhc->uwb_rc = NULL;
|
||||
result = wa_fill_descr(wa); /* Get the device descriptor */
|
||||
if (result < 0)
|
||||
goto error_fill_descriptor;
|
||||
@@ -731,8 +728,6 @@ error_wusbhc_create:
|
||||
/* WA Descr fill allocs no resources */
|
||||
error_security_create:
|
||||
error_fill_descriptor:
|
||||
uwb_rc_put(wusbhc->uwb_rc);
|
||||
error_rc_get:
|
||||
usb_put_intf(iface);
|
||||
usb_put_dev(usb_dev);
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user