git: 943df073a348 - main - LinuxKPI: USB return possible error from suspend/resume

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 24 Nov 2021 21:38:59 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=943df073a348bcb1e701c3677536f913761d4123

commit 943df073a348bcb1e701c3677536f913761d4123
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-11-24 21:28:46 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-11-24 21:32:38 +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
    MFC after:      10 days
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D33107
---
 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);
 }
 
 /*------------------------------------------------------------------------*