Skip to content

Commit

Permalink
staging/ozwpan: Fix NULL vs zero in ozcdev.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 41ebb8a commit bc501c5
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions drivers/staging/ozwpan/ozcdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ssize_t oz_cdev_read(struct file *filp, char __user *buf, size_t count,
int ix;

struct oz_pd *pd;
struct oz_serial_ctx *ctx = 0;
struct oz_serial_ctx *ctx;

spin_lock_bh(&g_cdev.lock);
pd = g_cdev.active_pd;
Expand Down Expand Up @@ -147,7 +147,7 @@ ssize_t oz_cdev_write(struct file *filp, const char __user *buf, size_t count,
{
struct oz_pd *pd;
struct oz_elt_buf *eb;
struct oz_elt_info *ei = 0;
struct oz_elt_info *ei;
struct oz_elt *elt;
struct oz_app_hdr *app_hdr;
struct oz_serial_ctx *ctx;
Expand Down Expand Up @@ -182,7 +182,7 @@ ssize_t oz_cdev_write(struct file *filp, const char __user *buf, size_t count,
ctx->tx_seq_num = 1;
spin_lock(&eb->lock);
if (oz_queue_elt_info(eb, 0, 0, ei) == 0)
ei = 0;
ei = NULL;
spin_unlock(&eb->lock);
}
spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]);
Expand Down Expand Up @@ -217,7 +217,7 @@ static int oz_set_active_pd(u8 *addr)
if (is_zero_ether_addr(addr)) {
spin_lock_bh(&g_cdev.lock);
pd = g_cdev.active_pd;
g_cdev.active_pd = 0;
g_cdev.active_pd = NULL;
memset(g_cdev.active_addr, 0,
sizeof(g_cdev.active_addr));
spin_unlock_bh(&g_cdev.lock);
Expand Down Expand Up @@ -385,7 +385,7 @@ int oz_cdev_deregister(void)
*/
int oz_cdev_init(void)
{
oz_event_log(OZ_EVT_SERVICE, 1, OZ_APPID_SERIAL, 0, 0);
oz_event_log(OZ_EVT_SERVICE, 1, OZ_APPID_SERIAL, NULL, 0);
oz_app_enable(OZ_APPID_SERIAL, 1);
return 0;
}
Expand All @@ -394,7 +394,7 @@ int oz_cdev_init(void)
*/
void oz_cdev_term(void)
{
oz_event_log(OZ_EVT_SERVICE, 2, OZ_APPID_SERIAL, 0, 0);
oz_event_log(OZ_EVT_SERVICE, 2, OZ_APPID_SERIAL, NULL, 0);
oz_app_enable(OZ_APPID_SERIAL, 0);
}
/*------------------------------------------------------------------------------
Expand All @@ -403,8 +403,8 @@ void oz_cdev_term(void)
int oz_cdev_start(struct oz_pd *pd, int resume)
{
struct oz_serial_ctx *ctx;
struct oz_serial_ctx *old_ctx = 0;
oz_event_log(OZ_EVT_SERVICE, 3, OZ_APPID_SERIAL, 0, resume);
struct oz_serial_ctx *old_ctx;
oz_event_log(OZ_EVT_SERVICE, 3, OZ_APPID_SERIAL, NULL, resume);
if (resume) {
oz_trace("Serial service resumed.\n");
return 0;
Expand Down Expand Up @@ -440,22 +440,22 @@ int oz_cdev_start(struct oz_pd *pd, int resume)
void oz_cdev_stop(struct oz_pd *pd, int pause)
{
struct oz_serial_ctx *ctx;
oz_event_log(OZ_EVT_SERVICE, 4, OZ_APPID_SERIAL, 0, pause);
oz_event_log(OZ_EVT_SERVICE, 4, OZ_APPID_SERIAL, NULL, pause);
if (pause) {
oz_trace("Serial service paused.\n");
return;
}
spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]);
ctx = (struct oz_serial_ctx *)pd->app_ctx[OZ_APPID_SERIAL-1];
pd->app_ctx[OZ_APPID_SERIAL-1] = 0;
pd->app_ctx[OZ_APPID_SERIAL-1] = NULL;
spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]);
if (ctx)
oz_cdev_release_ctx(ctx);
spin_lock(&g_cdev.lock);
if (pd == g_cdev.active_pd)
g_cdev.active_pd = 0;
g_cdev.active_pd = NULL;
else
pd = 0;
pd = NULL;
spin_unlock(&g_cdev.lock);
if (pd) {
oz_pd_put(pd);
Expand Down

0 comments on commit bc501c5

Please sign in to comment.