From ba346a4367a824a2c6337d4031fc9a82397a2abd Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Fri, 15 Feb 2013 15:22:27 +0100 Subject: [PATCH] staging/ozwpan: Fix NULL vs zero in ozusbsvc.c (sparse warning) This patch fixes the warning "Using plain integer as NULL pointer", generated by sparse, by replacing the offending 0s with NULL. If the initialization with NULL was unnecessary (due to unconditional assignment before first use) it was removed. Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ozwpan/ozusbsvc.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/ozwpan/ozusbsvc.c b/drivers/staging/ozwpan/ozusbsvc.c index 8fa7f256ad8c..543a9415975c 100644 --- a/drivers/staging/ozwpan/ozusbsvc.c +++ b/drivers/staging/ozwpan/ozusbsvc.c @@ -34,7 +34,7 @@ */ int oz_usb_init(void) { - oz_event_log(OZ_EVT_SERVICE, 1, OZ_APPID_USB, 0, 0); + oz_event_log(OZ_EVT_SERVICE, 1, OZ_APPID_USB, NULL, 0); return oz_hcd_init(); } /*------------------------------------------------------------------------------ @@ -43,7 +43,7 @@ int oz_usb_init(void) */ void oz_usb_term(void) { - oz_event_log(OZ_EVT_SERVICE, 2, OZ_APPID_USB, 0, 0); + oz_event_log(OZ_EVT_SERVICE, 2, OZ_APPID_USB, NULL, 0); oz_hcd_term(); } /*------------------------------------------------------------------------------ @@ -54,8 +54,8 @@ int oz_usb_start(struct oz_pd *pd, int resume) { int rc = 0; struct oz_usb_ctx *usb_ctx; - struct oz_usb_ctx *old_ctx = 0; - oz_event_log(OZ_EVT_SERVICE, 3, OZ_APPID_USB, 0, resume); + struct oz_usb_ctx *old_ctx; + oz_event_log(OZ_EVT_SERVICE, 3, OZ_APPID_USB, NULL, resume); if (resume) { oz_trace("USB service resumed.\n"); return 0; @@ -65,7 +65,7 @@ int oz_usb_start(struct oz_pd *pd, int resume) * has a USB context then we will destroy it. */ usb_ctx = kzalloc(sizeof(struct oz_usb_ctx), GFP_ATOMIC); - if (usb_ctx == 0) + if (usb_ctx == NULL) return -ENOMEM; atomic_set(&usb_ctx->ref_count, 1); usb_ctx->pd = pd; @@ -76,7 +76,7 @@ int oz_usb_start(struct oz_pd *pd, int resume) */ spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]); old_ctx = pd->app_ctx[OZ_APPID_USB-1]; - if (old_ctx == 0) + if (old_ctx == NULL) pd->app_ctx[OZ_APPID_USB-1] = usb_ctx; oz_usb_get(pd->app_ctx[OZ_APPID_USB-1]); spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]); @@ -98,10 +98,10 @@ int oz_usb_start(struct oz_pd *pd, int resume) oz_hcd_pd_reset(usb_ctx, usb_ctx->hport); } else { usb_ctx->hport = oz_hcd_pd_arrived(usb_ctx); - if (usb_ctx->hport == 0) { + if (usb_ctx->hport == NULL) { oz_trace("USB hub returned null port.\n"); spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]); - pd->app_ctx[OZ_APPID_USB-1] = 0; + pd->app_ctx[OZ_APPID_USB-1] = NULL; spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]); oz_usb_put(usb_ctx); rc = -1; @@ -117,14 +117,14 @@ int oz_usb_start(struct oz_pd *pd, int resume) void oz_usb_stop(struct oz_pd *pd, int pause) { struct oz_usb_ctx *usb_ctx; - oz_event_log(OZ_EVT_SERVICE, 4, OZ_APPID_USB, 0, pause); + oz_event_log(OZ_EVT_SERVICE, 4, OZ_APPID_USB, NULL, pause); if (pause) { oz_trace("USB service paused.\n"); return; } spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]); usb_ctx = (struct oz_usb_ctx *)pd->app_ctx[OZ_APPID_USB-1]; - pd->app_ctx[OZ_APPID_USB-1] = 0; + pd->app_ctx[OZ_APPID_USB-1] = NULL; spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]); if (usb_ctx) { unsigned long tout = jiffies + HZ; @@ -182,7 +182,7 @@ int oz_usb_heartbeat(struct oz_pd *pd) if (usb_ctx) oz_usb_get(usb_ctx); spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]); - if (usb_ctx == 0) + if (usb_ctx == NULL) return rc; if (usb_ctx->stopped) goto done; -- 2.34.1