Skip to content

Commit

Permalink
staging/ozwpan: Fix NULL vs zero in ozusbsvc.c (sparse warning)
Browse files Browse the repository at this point in the history
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 <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Huewe authored and Greg Kroah-Hartman committed Feb 15, 2013
1 parent bc501c5 commit ba346a4
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions drivers/staging/ozwpan/ozusbsvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
/*------------------------------------------------------------------------------
Expand All @@ -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();
}
/*------------------------------------------------------------------------------
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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]);
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ba346a4

Please sign in to comment.