Fix USB host error handling logic
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3593 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
51e4286fc6
commit
0320e6efdc
|
@ -249,6 +249,10 @@ static inline int usbhost_classbind(FAR struct usbhost_driver_s *drvr,
|
|||
ret = CLASS_CONNECT(devclass, configdesc, desclen, funcaddr);
|
||||
if (ret != OK)
|
||||
{
|
||||
/* On failures, call the class disconnect method which
|
||||
* should then free the allocated devclass instance.
|
||||
*/
|
||||
|
||||
udbg("CLASS_CONNECT failed: %d\n", ret);
|
||||
CLASS_DISCONNECTED(devclass);
|
||||
}
|
||||
|
|
|
@ -1545,6 +1545,10 @@ static FAR struct usbhost_class_s *usbhost_create(FAR struct usbhost_driver_s *d
|
|||
* On success, zero (OK) is returned. On a failure, a negated errno value is
|
||||
* returned indicating the nature of the failure
|
||||
*
|
||||
* NOTE that the class instance remains valid upon return with a failure. It is
|
||||
* the responsibility of the higher level enumeration logic to call
|
||||
* CLASS_DISCONNECTED to free up the class driver resources.
|
||||
*
|
||||
* Assumptions:
|
||||
* - This function will *not* be called from an interrupt handler.
|
||||
* - If this function returns an error, the USB host controller driver
|
||||
|
|
|
@ -673,14 +673,6 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv)
|
|||
}
|
||||
}
|
||||
|
||||
/* Disconnect on any errors detected during volume initialization */
|
||||
|
||||
if (ret != OK)
|
||||
{
|
||||
udbg("ERROR! Aborting: %d\n", ret);
|
||||
usbhost_destroy(priv);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -924,6 +916,10 @@ static FAR struct usbhost_class_s *usbhost_create(FAR struct usbhost_driver_s *d
|
|||
* On success, zero (OK) is returned. On a failure, a negated errno value is
|
||||
* returned indicating the nature of the failure
|
||||
*
|
||||
* NOTE that the class instance remains valid upon return with a failure. It is
|
||||
* the responsibility of the higher level enumeration logic to call
|
||||
* CLASS_DISCONNECTED to free up the class driver resources.
|
||||
*
|
||||
* Assumptions:
|
||||
* - This function will *not* be called from an interrupt handler.
|
||||
* - If this function returns an error, the USB host controller driver
|
||||
|
|
|
@ -937,6 +937,10 @@ static void usbhost_destroy(FAR void *arg)
|
|||
* On success, zero (OK) is returned. On a failure, a negated errno value is
|
||||
* returned indicating the nature of the failure
|
||||
*
|
||||
* NOTE that the class instance remains valid upon return with a failure. It is
|
||||
* the responsibility of the higher level enumeration logic to call
|
||||
* CLASS_DISCONNECTED to free up the class driver resources.
|
||||
*
|
||||
* Assumptions:
|
||||
* This function will *not* be called from an interrupt handler.
|
||||
*
|
||||
|
@ -1308,14 +1312,6 @@ static inline int usbhost_initvolume(FAR struct usbhost_state_s *priv)
|
|||
}
|
||||
}
|
||||
|
||||
/* Disconnect on any errors detected during volume initialization */
|
||||
|
||||
if (ret != OK)
|
||||
{
|
||||
udbg("ERROR! Aborting: %d\n", ret);
|
||||
usbhost_destroy(priv);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,10 @@
|
|||
* On success, zero (OK) is returned. On a failure, a negated errno value is
|
||||
* returned indicating the nature of the failure
|
||||
*
|
||||
* NOTE that the class instance remains valid upon return with a failure. It is
|
||||
* the responsibility of the higher level enumeration logic to call
|
||||
* CLASS_DISCONNECTED to free up the class driver resources.
|
||||
*
|
||||
* Assumptions:
|
||||
* - This function is probably called on the same thread that called the driver
|
||||
* enumerate() method. This function will *not* be called from an interrupt
|
||||
|
|
Loading…
Reference in New Issue