2019-10-15 14:20:50

by Ben Dooks

[permalink] [raw]
Subject: [PATCH] usb: ohci-nxp: fix use of integer as pointer

The hcd pointer in ohci_hcd_nxp_probe() is
being initialised with a 0, so fix to NULL to
avoid the following sparse warning:

drivers/usb/host/ohci-nxp.c:153:31: warning: Using plain integer as NULL pointer

Signed-off-by: Ben Dooks <[email protected]>
---
Cc: Vladimir Zapolskiy <[email protected]>
Cc: Sylvain Lemieux <[email protected]>
Cc: Alan Stern <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
drivers/usb/host/ohci-nxp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index c561881d0e79..85878e8ad331 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -150,7 +150,7 @@ static void ohci_nxp_stop_hc(void)

static int ohci_hcd_nxp_probe(struct platform_device *pdev)
{
- struct usb_hcd *hcd = 0;
+ struct usb_hcd *hcd = NULL;
const struct hc_driver *driver = &ohci_nxp_hc_driver;
struct resource *res;
int ret = 0, irq;
--
2.23.0


2019-10-19 09:08:50

by Sylvain Lemieux

[permalink] [raw]
Subject: Re: [PATCH] usb: ohci-nxp: fix use of integer as pointer

On Tue, Oct 15, 2019 at 10:19 AM Ben Dooks <[email protected]> wrote:
>
> The hcd pointer in ohci_hcd_nxp_probe() is
> being initialised with a 0, so fix to NULL to
> avoid the following sparse warning:
>
> drivers/usb/host/ohci-nxp.c:153:31: warning: Using plain integer as NULL pointer
>
> Signed-off-by: Ben Dooks <[email protected]>
> ---
[...]

> --- a/drivers/usb/host/ohci-nxp.c
> +++ b/drivers/usb/host/ohci-nxp.c
> @@ -150,7 +150,7 @@ static void ohci_nxp_stop_hc(void)
>
> static int ohci_hcd_nxp_probe(struct platform_device *pdev)
> {
> - struct usb_hcd *hcd = 0;
> + struct usb_hcd *hcd = NULL;
> const struct hc_driver *driver = &ohci_nxp_hc_driver;
> struct resource *res;
> int ret = 0, irq;
> --
> 2.23.0
>
Acked-by: Sylvain Lemieux <[email protected]>