* [PATCH] usb: host: xhci: make 'usec' parameter of xhci_handshake() *unsigned*
@ 2022-02-15 20:09 Sergey Shtylyov
2022-02-16 10:40 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Sergey Shtylyov @ 2022-02-15 20:09 UTC (permalink / raw)
To: Mathias Nyman, linux-usb, Greg Kroah-Hartman
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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: host: xhci: make 'usec' parameter of xhci_handshake() *unsigned*
2022-02-15 20:09 [PATCH] usb: host: xhci: make 'usec' parameter of xhci_handshake() *unsigned* Sergey Shtylyov
@ 2022-02-16 10:40 ` Greg Kroah-Hartman
2022-02-16 11:10 ` Sergey Shtylyov
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-02-16 10:40 UTC (permalink / raw)
To: Sergey Shtylyov; +Cc: Mathias Nyman, linux-usb
On Tue, Feb 15, 2022 at 11:09:21PM +0300, Sergey Shtylyov wrote:
> 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...
Then why not just make it a u64 instead of a unsigned int?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: host: xhci: make 'usec' parameter of xhci_handshake() *unsigned*
2022-02-16 10:40 ` Greg Kroah-Hartman
@ 2022-02-16 11:10 ` Sergey Shtylyov
0 siblings, 0 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2022-02-16 11:10 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Mathias Nyman, linux-usb
On 2/16/22 1:40 PM, Greg Kroah-Hartman wrote:
>> 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...
>
> Then why not just make it a u64 instead of a unsigned int?
Because *unsigned int* is enough? :-)
> thanks,
>
> greg k-h
MBR, Sergey
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-16 11:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15 20:09 [PATCH] usb: host: xhci: make 'usec' parameter of xhci_handshake() *unsigned* Sergey Shtylyov
2022-02-16 10:40 ` Greg Kroah-Hartman
2022-02-16 11:10 ` Sergey Shtylyov
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.