[PATCH v3 3/8] char: xillybus: Return error in fops read method handler
From: Eli Billauer
Date: Fri Nov 20 2026 - 08:06:14 EST
Be sure to return an error status from the driver's read fops method when
the USB device is unplugged or a hardware error occurs, and all available
data has been delivered.
Before this patch, the return value was zero in this case, meaning EOF,
which didn't expose the reason for ending the data stream.
The existing memory barrier smp_rmb(), together with the assignment of
xdev->error in report_io_error() with a spinlock taken, ensure that
xdev->error has its updated value when the hereby corrected assignment
takes place.
Fixes: a53d1202aef1 ("char: xillybus: Add driver for XillyUSB (Xillybus variant for USB)")
Assisted-by: Sashiko-0.2.5:gemini-3.1-pro-preview
Link: https://sashiko.dev/#/patchset/20260724094302.50761-1-eli.billauer@xxxxxxxxx
Signed-off-by: Eli Billauer <eli.billauer@xxxxxxxxx>
---
Notes:
Changes in v3:
- No changes.
Changes in v2:
- Added Fixes: tag.
drivers/char/xillybus/xillyusb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/xillybus/xillyusb.c b/drivers/char/xillybus/xillyusb.c
index 16d6101d9269..1aa8e7303ad1 100644
--- a/drivers/char/xillybus/xillyusb.c
+++ b/drivers/char/xillybus/xillyusb.c
@@ -1541,7 +1541,7 @@ static ssize_t xillyusb_read(struct file *filp, char __user *userbuf,
if (READ_ONCE(fifo->fill))
continue;
- rc = 0;
+ rc = xdev->error; /* Usually zero, meaning EOF */
break;
}
--
2.17.1