git: 49633d5d02e1 - main - umass: Simplify umass_std_transform to eliminate fake success

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 07 May 2025 21:37:09 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=49633d5d02e1c6cea718d0581974d614534019c8

commit 49633d5d02e1c6cea718d0581974d614534019c8
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-05-07 16:07:22 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-05-07 21:36:54 +0000

    umass: Simplify umass_std_transform to eliminate fake success
    
    Now that nothing returns (2) to fake the success of the command,
    eliminate that magic number by eliminating the case.
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D49469
---
 sys/dev/usb/storage/umass.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c
index bdbe04ce3bbd..9878635f7e59 100644
--- a/sys/dev/usb/storage/umass.c
+++ b/sys/dev/usb/storage/umass.c
@@ -2949,20 +2949,13 @@ umass_std_transform(struct umass_softc *sc, union ccb *ccb,
 {
 	uint8_t retval;
 
-	retval = (sc->sc_transform) (sc, cmd, cmdlen);
+	if (sc->sc_transform(sc, cmd, cmdlen))
+		return (1);	/* Execute command */
 
-	if (retval == 2) {
-		ccb->ccb_h.status = CAM_REQ_CMP;
-		xpt_done(ccb);
-		return (0);
-	} else if (retval == 0) {
-		xpt_freeze_devq(ccb->ccb_h.path, 1);
-		ccb->ccb_h.status = CAM_REQ_INVALID | CAM_DEV_QFRZN;
-		xpt_done(ccb);
-		return (0);
-	}
-	/* Command should be executed */
-	return (1);
+	xpt_freeze_devq(ccb->ccb_h.path, 1);
+	ccb->ccb_h.status = CAM_REQ_INVALID | CAM_DEV_QFRZN;
+	xpt_done(ccb);
+	return (0);		/* Already failed */
 }
 
 #ifdef USB_DEBUG