mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 6/7] staging/ozwpan: Fix NULL vs zero in ozusbsvc.c (sparse warning)
Date: Fri, 15 Feb 2013 15:22:27 +0100	[thread overview]
Message-ID: <1360938148-19225-6-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/ozusbsvc.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/ozwpan/ozusbsvc.c b/drivers/staging/ozwpan/ozusbsvc.c
index 8fa7f25..543a941 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;
-- 
1.7.8.6


  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     ` [PATCH 5/7 v2] staging/ozwpan: Fix NULL vs zero in ozcdev.c " Peter Huewe
2013-02-15 14:22     ` Peter Huewe [this message]
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-6-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®