All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: misc: cypress_cy7c63: check control transfer status
@ 2026-06-18 20:30 Keshav Verma
  0 siblings, 0 replies; only message in thread
From: Keshav Verma @ 2026-06-18 20:30 UTC (permalink / raw)
  To: gregkh; +Cc: johan, kees, o.bock, linux-usb, linux-kernel, Keshav Verma

read_port() currently ignores errors from vendor_command() and always
returns the cached port value. This can report stale data when the USB
control transfer fails or returns a short response.

Return the underlying error for failed transfers and report -EIO if the
device returns fewer bytes than required.

Fixes: 9189bfc2df0f ("[PATCH] USB: rename Cypress CY7C63xxx driver to proper name and fix up some tiny things")
Signed-off-by: Keshav Verma <iganschel@gmail.com>
---
 drivers/usb/misc/cypress_cy7c63.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c
index 4a7f955ba85b..8601ee0a1ea3 100644
--- a/drivers/usb/misc/cypress_cy7c63.c
+++ b/drivers/usb/misc/cypress_cy7c63.c
@@ -177,6 +177,10 @@ static ssize_t read_port(struct device *dev, struct device_attribute *attr,
 	result = vendor_command(cyp, CYPRESS_READ_PORT, read_id, 0);
 
 	dev_dbg(&cyp->udev->dev, "Result of vendor_command: %d\n\n", result);
+	if (result < 0)
+		return result;
+	if (result < 2)
+		return -EIO;
 
 	return sprintf(buf, "%d", cyp->port[port_num]);
 }
-- 
2.39.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-18 20:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18 20:30 [PATCH] usb: misc: cypress_cy7c63: check control transfer status Keshav Verma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.