From: Keshav Verma <iganschel@gmail.com>
To: gregkh@linuxfoundation.org
Cc: johan@kernel.org, kees@kernel.org, o.bock@fh-wolfenbuettel.de,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Keshav Verma <iganschel@gmail.com>
Subject: [PATCH] usb: misc: cypress_cy7c63: check control transfer status
Date: Fri, 19 Jun 2026 02:00:53 +0530 [thread overview]
Message-ID: <20260618203053.4725-1-iganschel@gmail.com> (raw)
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
reply other threads:[~2026-06-18 20:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260618203053.4725-1-iganschel@gmail.com \
--to=iganschel@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=o.bock@fh-wolfenbuettel.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox