git: 2c6ebb783462 - stable/13 - LinuxKPI: USB return possible error from suspend/resume

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Thu, 30 Dec 2021 19:22:33 UTC
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=2c6ebb783462a2776823fc4c629c98c657014108

commit 2c6ebb783462a2776823fc4c629c98c657014108
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-11-24 21:28:46 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-12-30 18:25:28 +0000

    LinuxKPI: USB return possible error from suspend/resume
    
    USB suspend/resume cannot fail so we never returned the error which
    resulted in a -Wunused-but-set-variable warning.
    Initialize the return variable and return a possible error possibly
    triggering a printf upstream to at least have a trace of the problem.
    This also fixes the warning.
    
    Suggested by:   hselasky
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D33107
    
    (cherry picked from commit 943df073a348bcb1e701c3677536f913761d4123)
---
 sys/compat/linuxkpi/common/src/linux_usb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_usb.c b/sys/compat/linuxkpi/common/src/linux_usb.c
index 11f400bc2c52..72aa561fcfbb 100644
--- a/sys/compat/linuxkpi/common/src/linux_usb.c
+++ b/sys/compat/linuxkpi/common/src/linux_usb.c
@@ -343,10 +343,10 @@ usb_linux_suspend(device_t dev)
 	struct usb_driver *udrv = usb_linux_get_usb_driver(sc);
 	int err;
 
-	if (udrv && udrv->suspend) {
+	err = 0;
+	if (udrv && udrv->suspend)
 		err = (udrv->suspend) (sc->sc_ui, 0);
-	}
-	return (0);
+	return (-err);
 }
 
 /*------------------------------------------------------------------------*
@@ -361,10 +361,10 @@ usb_linux_resume(device_t dev)
 	struct usb_driver *udrv = usb_linux_get_usb_driver(sc);
 	int err;
 
-	if (udrv && udrv->resume) {
+	err = 0;
+	if (udrv && udrv->resume)
 		err = (udrv->resume) (sc->sc_ui);
-	}
-	return (0);
+	return (-err);
 }
 
 /*------------------------------------------------------------------------*