From: Peter Huewe <peterhuewe@gmx.de>
To: Rupesh Gujare <rupesh.gujare@atmel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>,
Peter Huewe <peterhuewe@gmx.de>
Subject: [PATCH 5/7 v2] staging/ozwpan: Fix NULL vs zero in ozcdev.c (sparse warning)
Date: Fri, 15 Feb 2013 15:22:26 +0100 [thread overview]
Message-ID: <1360938148-19225-5-git-send-email-peterhuewe@gmx.de> (raw)
In-Reply-To: <1360938148-19225-1-git-send-email-peterhuewe@gmx.de>
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>
---
drivers/staging/ozwpan/ozcdev.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c
index 64913ae..a38716f 100644
--- a/drivers/staging/ozwpan/ozcdev.c
+++ b/drivers/staging/ozwpan/ozcdev.c
@@ -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;
@@ -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;
@@ -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]);
@@ -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);
@@ -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;
}
@@ -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);
}
/*------------------------------------------------------------------------------
@@ -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;
@@ -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);
--
1.7.8.6
next prev parent reply other threads:[~2013-02-15 14:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-15 5:25 [PATCH 1/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer Peter Huewe
2013-02-15 5:25 ` [PATCH 2/7] " Peter Huewe
2013-02-15 5:25 ` [PATCH 3/7] " Peter Huewe
2013-02-15 5:25 ` [PATCH 4/7] " Peter Huewe
2013-02-15 5:25 ` [PATCH 5/7] " Peter Huewe
2013-02-15 5:25 ` [PATCH 6/7] " Peter Huewe
2013-02-15 5:25 ` [PATCH 7/7] " Peter Huewe
2013-02-15 8:45 ` [PATCH 1/7] " Dan Carpenter
2013-02-15 14:22 ` [PATCH 1/7 v2] staging/ozwpan: Fix NULL vs zero in ozpd.c (sparse warning) Peter Huewe
2013-02-15 14:22 ` [PATCH 2/7 v2] staging/ozwpan: Fix NULL vs zero in ozusbsvc1.c " Peter Huewe
2013-02-15 14:22 ` [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c " Peter Huewe
2013-02-15 14:52 ` Dan Carpenter
2013-02-15 15:57 ` Clang Analyzer was " Peter Huewe
2013-02-15 16:11 ` Dan Carpenter
2013-02-15 16:34 ` Peter Hüwe
2013-02-15 14:22 ` [PATCH 4/7 v2] staging/ozwpan: Fix NULL vs zero in ozproto.c " Peter Huewe
2013-02-15 14:22 ` Peter Huewe [this message]
2013-02-15 14:22 ` [PATCH 6/7] staging/ozwpan: Fix NULL vs zero in ozusbsvc.c " Peter Huewe
2013-02-15 14:22 ` [PATCH 7/7] staging/ozwpan: Fix NULL vs zero in ozhcd.c " Peter Huewe
2013-02-15 18:56 ` Rupesh Gujare
2013-02-15 14:55 ` [PATCH 1/7 v2] staging/ozwpan: Fix NULL vs zero in ozpd.c " Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1360938148-19225-5-git-send-email-peterhuewe@gmx.de \
--to=peterhuewe@gmx.de \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rupesh.gujare@atmel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®