git: 966c36c1b65e - stable/13 - usb(4): Ignore port resume failures.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Thu, 10 Feb 2022 15:16:53 UTC
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=966c36c1b65e0dcc6fbd09469b511adae881486e

commit 966c36c1b65e0dcc6fbd09469b511adae881486e
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-02-02 11:59:00 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-02-10 15:10:53 +0000

    usb(4): Ignore port resume failures.
    
    If port resume fails, likely the USB device is detached. Ignore such errors,
    because else the USB stack might try forever trying to resume the device,
    before it will proceed detaching it.
    
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit a88e1a04df8bf192da607cfb068020c357a4c3ce)
---
 sys/dev/usb/usb_hub.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c
index 52ac0a8a7ff7..17bdac68c465 100644
--- a/sys/dev/usb/usb_hub.c
+++ b/sys/dev/usb/usb_hub.c
@@ -4,7 +4,7 @@
  *
  * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
  * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
- * Copyright (c) 2008-2010 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2008-2022 Hans Petter Selasky. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -2669,18 +2669,15 @@ usb_dev_resume_peer(struct usb_device *udev)
 		/* resume current port (Valid in Host and Device Mode) */
 		err = usbd_req_clear_port_feature(udev->parent_hub,
 		    NULL, udev->port_no, UHF_PORT_SUSPEND);
-		if (err) {
-			DPRINTFN(0, "Resuming port failed\n");
-			return;
-		}
 	} else {
 		/* resume current port (Valid in Host and Device Mode) */
 		err = usbd_req_set_port_link_state(udev->parent_hub,
 		    NULL, udev->port_no, UPS_PORT_LS_U0);
-		if (err) {
-			DPRINTFN(0, "Resuming port failed\n");
-			return;
-		}
+	}
+
+	if (err != 0) {
+		DPRINTFN(0, "Resuming port failed: %s (ignored)\n",
+		    usbd_errstr(err));
 	}
 
 	/* resume settle time */