]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
USB: usb-storage: ene_ub6250: restore media-ready check
authorXu Rao <raoxu@uniontech.com>
Fri, 26 Jun 2026 07:06:07 +0000 (15:06 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Jul 2026 11:30:11 +0000 (13:30 +0200)
Commit 1892bf90677a ("USB: usb-storage: Fix use of bitfields for
hardware data in ene_ub6250.c") converted the media status fields from
bitfields to bit masks.

The original ene_transport() test called ene_init() only when neither
media type was ready:

        !(sd_ready || ms_ready)

The converted test became:

        !sd_ready || ms_ready

This is not equivalent. Restore the original semantics by testing that
both ready bits are clear before calling ene_init().

Fixes: 1892bf90677a ("USB: usb-storage: Fix use of bitfields for hardware data in ene_ub6250.c")
Cc: stable <stable@kernel.org>
Signed-off-by: Xu Rao <raoxu@uniontech.com>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://patch.msgid.link/F42641386E32404F+20260626070607.4119527-1-raoxu@uniontech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/ene_ub6250.c

index 8770de01a384ddb3dccc98565fc36e1584b5e7a6..ed49a3bc859ce5f039d212874dcadb755e2ab462 100644 (file)
@@ -2305,7 +2305,8 @@ static int ene_transport(struct scsi_cmnd *srb, struct us_data *us)
 
        /*US_DEBUG(usb_stor_show_command(us, srb)); */
        scsi_set_resid(srb, 0);
-       if (unlikely(!(info->SD_Status & SD_Ready) || (info->MS_Status & MS_Ready)))
+       if (unlikely(!(info->SD_Status & SD_Ready) &&
+                    !(info->MS_Status & MS_Ready)))
                result = ene_init(us);
        if (result == USB_STOR_XFER_GOOD) {
                result = USB_STOR_TRANSPORT_ERROR;