From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Mathias Nyman <mathias.nyman@intel.com>,
<linux-usb@vger.kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: [PATCH] usb: host: xhci: make 'usec' parameter of xhci_handshake() *unsigned*
Date: Tue, 15 Feb 2022 23:09:21 +0300 [thread overview]
Message-ID: <e8e27f4c-489e-08c2-7495-7bfe07bf6f97@omp.ru> (raw)
The negative timeouts hardly make sense, and the 'usec' parameter of
xhci_handshake() gets assigned to a 'u64' typed local variable in
readl_poll_timeout_atomic() anyways...
Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
This patch is against the 'usb-next' branch of Greg KH's 'usb.git' repo.
drivers/usb/host/xhci.c | 2 +-
drivers/usb/host/xhci.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: usb/drivers/usb/host/xhci.c
===================================================================
--- usb.orig/drivers/usb/host/xhci.c
+++ usb/drivers/usb/host/xhci.c
@@ -65,7 +65,7 @@ static bool td_on_ring(struct xhci_td *t
* handshake done). There are two failure modes: "usec" have passed (major
* hardware flakeout), or the register reads as all-ones (hardware removed).
*/
-int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec)
+int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, unsigned int usec)
{
u32 result;
int ret;
Index: usb/drivers/usb/host/xhci.h
===================================================================
--- usb.orig/drivers/usb/host/xhci.h
+++ usb/drivers/usb/host/xhci.h
@@ -2083,7 +2083,7 @@ void xhci_free_container_ctx(struct xhci
/* xHCI host controller glue */
typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *);
-int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec);
+int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, unsigned int usec);
void xhci_quiesce(struct xhci_hcd *xhci);
int xhci_halt(struct xhci_hcd *xhci);
int xhci_start(struct xhci_hcd *xhci);
next reply other threads:[~2022-02-15 20:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 20:09 Sergey Shtylyov [this message]
2022-02-16 10:40 ` [PATCH] usb: host: xhci: make 'usec' parameter of xhci_handshake() *unsigned* Greg Kroah-Hartman
2022-02-16 11:10 ` Sergey Shtylyov
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=e8e27f4c-489e-08c2-7495-7bfe07bf6f97@omp.ru \
--to=s.shtylyov@omp.ru \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
/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