You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ra...@apache.org on 2023/09/19 05:51:55 UTC

[nuttx] 01/02: rndis: Fixed rndis assert issue when calling composite_uninitlize

This is an automated email from the ASF dual-hosted git repository.

raiden00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 219677cdaeb18488565d1021cd8660f2630a98df
Author: sunkun3 <su...@xiaomi.com>
AuthorDate: Thu Aug 31 21:06:21 2023 +0800

    rndis: Fixed rndis assert issue when calling composite_uninitlize
    
    Signed-off-by: sunkun3 <su...@xiaomi.com>
---
 drivers/usbdev/rndis.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c
index 20672803fc..e6f798eb60 100644
--- a/drivers/usbdev/rndis.c
+++ b/drivers/usbdev/rndis.c
@@ -2308,11 +2308,15 @@ static void usbclass_unbind(FAR struct usbdevclass_driver_s *driver,
        */
 
       if (priv->rdreq)
-      {
-        usbdev_freereq(priv->epbulkout, priv->rdreq);
-      }
+        {
+          usbdev_freereq(priv->epbulkout, priv->rdreq);
+        }
 
-      netdev_unregister(&priv->netdev);
+      if (priv->registered)
+        {
+          netdev_unregister(&priv->netdev);
+          priv->registered = false;
+        }
 
       /* Free write requests that are not in use (which should be all
        * of them