[PATCH] USB: usb-storage: ene_ub6250: restore media-ready check

2 views
Skip to first unread message

raoxu

unread,
Jun 26, 2026, 3:06:44 AMJun 26
to st...@rowland.harvard.edu, gre...@linuxfoundation.org, linu...@vger.kernel.org, usb-s...@lists.one-eyed-alien.net, linux-...@vger.kernel.org, ra...@uniontech.com, sta...@vger.kernel.org
From: Xu Rao <ra...@uniontech.com>

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: sta...@vger.kernel.org
Signed-off-by: Xu Rao <ra...@uniontech.com>
---
drivers/usb/storage/ene_ub6250.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
index 8770de01a384..ed49a3bc859c 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -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;
--
2.50.1

Alan Stern

unread,
Jun 26, 2026, 2:49:28 PM (14 days ago) Jun 26
to raoxu, gre...@linuxfoundation.org, linu...@vger.kernel.org, usb-s...@lists.one-eyed-alien.net, linux-...@vger.kernel.org, sta...@vger.kernel.org
Thanks for fixing this.

Reviewed-by: Alan Stern <st...@rowland.harvard.edu>

How on earth did you find the error? It doesn't exactly spring to the
eye.

Alan Stern
Reply all
Reply to author
Forward
0 new messages