All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer
@ 2013-02-15  5:25 Peter Huewe
  2013-02-15  5:25 ` [PATCH 2/7] " Peter Huewe
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15  5:25 UTC (permalink / raw)
  To: Rupesh Gujare; +Cc: Greg Kroah-Hartman, devel, linux-kernel, Peter Huewe

This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
I split up this patch series on a per file basis so that review is easier.

 drivers/staging/ozwpan/ozpd.c |   68 ++++++++++++++++++++--------------------
 1 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c
index 118a4db..191b63e 100644
--- a/drivers/staging/ozwpan/ozpd.c
+++ b/drivers/staging/ozwpan/ozpd.c
@@ -61,8 +61,8 @@ static struct oz_app_if g_app_if[OZ_APPID_MAX] = {
 	oz_def_app_start,
 	oz_def_app_stop,
 	oz_def_app_rx,
-	0,
-	0,
+	NULL,
+	NULL,
 	OZ_APPID_UNUSED1},
 
 	{oz_def_app_init,
@@ -70,8 +70,8 @@ static struct oz_app_if g_app_if[OZ_APPID_MAX] = {
 	oz_def_app_start,
 	oz_def_app_stop,
 	oz_def_app_rx,
-	0,
-	0,
+	NULL,
+	NULL,
 	OZ_APPID_UNUSED2},
 
 	{oz_cdev_init,
@@ -79,8 +79,8 @@ static struct oz_app_if g_app_if[OZ_APPID_MAX] = {
 	oz_cdev_start,
 	oz_cdev_stop,
 	oz_cdev_rx,
-	0,
-	0,
+	NULL,
+	NULL,
 	OZ_APPID_SERIAL},
 };
 /*------------------------------------------------------------------------------
@@ -121,7 +121,7 @@ static void oz_def_app_rx(struct oz_pd *pd, struct oz_elt *elt)
 void oz_pd_set_state(struct oz_pd *pd, unsigned state)
 {
 	pd->state = state;
-	oz_event_log(OZ_EVT_PD_STATE, 0, 0, 0, state);
+	oz_event_log(OZ_EVT_PD_STATE, 0, 0, NULL, state);
 #ifdef WANT_TRACE
 	switch (state) {
 	case OZ_PD_S_IDLE:
@@ -171,7 +171,7 @@ struct oz_pd *oz_pd_alloc(u8 *mac_addr)
 		memcpy(pd->mac_addr, mac_addr, ETH_ALEN);
 		if (0 != oz_elt_buf_init(&pd->elt_buff)) {
 			kfree(pd);
-			pd = 0;
+			pd = NULL;
 		}
 		spin_lock_init(&pd->tx_frame_lock);
 		INIT_LIST_HEAD(&pd->tx_queue);
@@ -355,7 +355,7 @@ int oz_pd_sleep(struct oz_pd *pd)
  */
 static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd)
 {
-	struct oz_tx_frame *f = 0;
+	struct oz_tx_frame *f = NULL;
 	spin_lock_bh(&pd->tx_frame_lock);
 	if (pd->tx_pool) {
 		f = container_of(pd->tx_pool, struct oz_tx_frame, link);
@@ -363,7 +363,7 @@ static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd)
 		pd->tx_pool_count--;
 	}
 	spin_unlock_bh(&pd->tx_frame_lock);
-	if (f == 0)
+	if (f == NULL)
 		f = kmalloc(sizeof(struct oz_tx_frame), GFP_ATOMIC);
 	if (f) {
 		f->total_size = sizeof(struct oz_hdr);
@@ -399,7 +399,7 @@ static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f)
 		f->link.next = pd->tx_pool;
 		pd->tx_pool = &f->link;
 		pd->tx_pool_count++;
-		f = 0;
+		f = NULL;
 	}
 	spin_unlock_bh(&pd->tx_frame_lock);
 	kfree(f);
@@ -433,7 +433,7 @@ int oz_prepare_frame(struct oz_pd *pd, int empty)
 	if (!empty && !oz_are_elts_available(&pd->elt_buff))
 		return -1;
 	f = oz_tx_frame_alloc(pd);
-	if (f == 0)
+	if (f == NULL)
 		return -1;
 	f->skb = NULL;
 	f->hdr.control =
@@ -455,7 +455,7 @@ int oz_prepare_frame(struct oz_pd *pd, int empty)
  */
 static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f)
 {
-	struct sk_buff *skb = 0;
+	struct sk_buff *skb = NULL;
 	struct net_device *dev = pd->net_dev;
 	struct oz_hdr *oz_hdr;
 	struct oz_elt *elt;
@@ -464,8 +464,8 @@ static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f)
 	 * as the space we need.
 	 */
 	skb = alloc_skb(f->total_size + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC);
-	if (skb == 0)
-		return 0;
+	if (skb == NULL)
+		return NULL;
 	/* Reserve the head room for lower layers.
 	 */
 	skb_reserve(skb, LL_RESERVED_SPACE(dev));
@@ -492,7 +492,7 @@ static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f)
 	return skb;
 fail:
 	kfree_skb(skb);
-	return 0;
+	return NULL;
 }
 /*------------------------------------------------------------------------------
  * Context: softirq or process
@@ -544,7 +544,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data)
 			if (dev_queue_xmit(skb) < 0) {
 				oz_trace2(OZ_TRACE_TX_FRAMES,
 						"Dropping ISOC Frame\n");
-				oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0);
+				oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0);
 				return -1;
 			}
 			atomic_inc(&g_submitted_isoc);
@@ -555,7 +555,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data)
 		} else {
 			kfree_skb(skb);
 			oz_trace2(OZ_TRACE_TX_FRAMES, "Dropping ISOC Frame>\n");
-			oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0);
+			oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0);
 			return -1;
 		}
 	}
@@ -570,7 +570,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data)
 		oz_event_log(OZ_EVT_TX_FRAME,
 			0,
 			(((u16)f->hdr.control)<<8)|f->hdr.last_pkt_num,
-			0, f->hdr.pkt_num);
+			NULL, f->hdr.pkt_num);
 		if (dev_queue_xmit(skb) < 0)
 			return -1;
 
@@ -620,7 +620,7 @@ out:	oz_prepare_frame(pd, 1);
  */
 static int oz_send_isoc_frame(struct oz_pd *pd)
 {
-	struct sk_buff *skb = 0;
+	struct sk_buff *skb = NULL;
 	struct net_device *dev = pd->net_dev;
 	struct oz_hdr *oz_hdr;
 	struct oz_elt *elt;
@@ -634,7 +634,7 @@ static int oz_send_isoc_frame(struct oz_pd *pd)
 	if (list.next == &list)
 		return 0;
 	skb = alloc_skb(total_size + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC);
-	if (skb == 0) {
+	if (skb == NULL) {
 		oz_trace("Cannot alloc skb\n");
 		oz_elt_info_free_chain(&pd->elt_buff, &list);
 		return -1;
@@ -659,7 +659,7 @@ static int oz_send_isoc_frame(struct oz_pd *pd)
 		memcpy(elt, ei->data, ei->length);
 		elt = oz_next_elt(elt);
 	}
-	oz_event_log(OZ_EVT_TX_ISOC, 0, 0, 0, 0);
+	oz_event_log(OZ_EVT_TX_ISOC, 0, 0, NULL, 0);
 	dev_queue_xmit(skb);
 	oz_elt_info_free_chain(&pd->elt_buff, &list);
 	return 0;
@@ -671,8 +671,8 @@ void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn)
 {
 	struct list_head *e;
 	struct oz_tx_frame *f;
-	struct list_head *first = 0;
-	struct list_head *last = 0;
+	struct list_head *first = NULL;
+	struct list_head *last = NULL;
 	u8 diff;
 	u32 pkt_num;
 
@@ -686,7 +686,7 @@ void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn)
 			break;
 		oz_trace2(OZ_TRACE_TX_FRAMES, "Releasing pkt_num= %u, nb= %d\n",
 						 pkt_num, pd->nb_queued_frames);
-		if (first == 0)
+		if (first == NULL)
 			first = e;
 		last = e;
 		e = e->next;
@@ -695,7 +695,7 @@ void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn)
 	if (first) {
 		last->next->prev = &pd->tx_queue;
 		pd->tx_queue.next = last->next;
-		last->next = 0;
+		last->next = NULL;
 	}
 	pd->last_sent_frame = &pd->tx_queue;
 	spin_unlock(&pd->tx_frame_lock);
@@ -718,7 +718,7 @@ static struct oz_isoc_stream *pd_stream_find(struct oz_pd *pd, u8 ep_num)
 		if (st->ep_num == ep_num)
 			return st;
 	}
-	return 0;
+	return NULL;
 }
 /*------------------------------------------------------------------------------
  * Context: softirq
@@ -733,7 +733,7 @@ int oz_isoc_stream_create(struct oz_pd *pd, u8 ep_num)
 	spin_lock_bh(&pd->stream_lock);
 	if (!pd_stream_find(pd, ep_num)) {
 		list_add(&st->link, &pd->stream_list);
-		st = 0;
+		st = NULL;
 	}
 	spin_unlock_bh(&pd->stream_lock);
 	kfree(st);
@@ -779,14 +779,14 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len)
 	struct net_device *dev = pd->net_dev;
 	struct oz_isoc_stream *st;
 	u8 nb_units = 0;
-	struct sk_buff *skb = 0;
-	struct oz_hdr *oz_hdr = 0;
+	struct sk_buff *skb = NULL;
+	struct oz_hdr *oz_hdr = NULL;
 	int size = 0;
 	spin_lock_bh(&pd->stream_lock);
 	st = pd_stream_find(pd, ep_num);
 	if (st) {
 		skb = st->skb;
-		st->skb = 0;
+		st->skb = NULL;
 		nb_units = st->nb_units;
 		st->nb_units = 0;
 		oz_hdr = st->oz_hdr;
@@ -799,7 +799,7 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len)
 		/* Allocate enough space for max size frame. */
 		skb = alloc_skb(pd->max_tx_size + OZ_ALLOCATED_SPACE(dev),
 				GFP_ATOMIC);
-		if (skb == 0)
+		if (skb == NULL)
 			return 0;
 		/* Reserve the head room for lower layers. */
 		skb_reserve(skb, LL_RESERVED_SPACE(dev));
@@ -874,13 +874,13 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len)
 			oz_event_log(OZ_EVT_TX_ISOC, nb_units, iso.frame_number,
 					skb, atomic_read(&g_submitted_isoc));
 			if (dev_queue_xmit(skb) < 0) {
-				oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0);
+				oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0);
 				return -1;
 			} else
 				return 0;
 		}
 
-out:	oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0);
+out:	oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0);
 	kfree_skb(skb);
 	return -1;
 
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 2/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer
  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 ` Peter Huewe
  2013-02-15  5:25 ` [PATCH 3/7] " Peter Huewe
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15  5:25 UTC (permalink / raw)
  To: Rupesh Gujare; +Cc: Greg Kroah-Hartman, devel, linux-kernel, Peter Huewe

This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/ozwpan/ozusbsvc1.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/ozwpan/ozusbsvc1.c b/drivers/staging/ozwpan/ozusbsvc1.c
index 66bd576..ea4a238b 100644
--- a/drivers/staging/ozwpan/ozusbsvc1.c
+++ b/drivers/staging/ozwpan/ozusbsvc1.c
@@ -71,7 +71,7 @@ int oz_usb_get_desc_req(void *hpd, u8 req_id, u8 req_type, u8 desc_type,
 	oz_trace("    len = 0x%x\n", len);
 	if (len > 200)
 		len = 200;
-	if (ei == 0)
+	if (ei == NULL)
 		return -1;
 	elt = (struct oz_elt *)ei->data;
 	elt->length = sizeof(struct oz_get_desc_req);
@@ -97,7 +97,7 @@ static int oz_usb_set_config_req(void *hpd, u8 req_id, u8 index)
 	struct oz_elt_buf *eb = &pd->elt_buff;
 	struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
 	struct oz_set_config_req *body;
-	if (ei == 0)
+	if (ei == NULL)
 		return -1;
 	elt = (struct oz_elt *)ei->data;
 	elt->length = sizeof(struct oz_set_config_req);
@@ -118,7 +118,7 @@ static int oz_usb_set_interface_req(void *hpd, u8 req_id, u8 index, u8 alt)
 	struct oz_elt_buf *eb = &pd->elt_buff;
 	struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
 	struct oz_set_interface_req *body;
-	if (ei == 0)
+	if (ei == NULL)
 		return -1;
 	elt = (struct oz_elt *)ei->data;
 	elt->length = sizeof(struct oz_set_interface_req);
@@ -141,7 +141,7 @@ static int oz_usb_set_clear_feature_req(void *hpd, u8 req_id, u8 type,
 	struct oz_elt_buf *eb = &pd->elt_buff;
 	struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
 	struct oz_feature_req *body;
-	if (ei == 0)
+	if (ei == NULL)
 		return -1;
 	elt = (struct oz_elt *)ei->data;
 	elt->length = sizeof(struct oz_feature_req);
@@ -165,7 +165,7 @@ static int oz_usb_vendor_class_req(void *hpd, u8 req_id, u8 req_type,
 	struct oz_elt_buf *eb = &pd->elt_buff;
 	struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
 	struct oz_vendor_class_req *body;
-	if (ei == 0)
+	if (ei == NULL)
 		return -1;
 	elt = (struct oz_elt *)ei->data;
 	elt->length = sizeof(struct oz_vendor_class_req) - 1 + data_len;
@@ -264,7 +264,7 @@ int oz_usb_send_isoc(void *hpd, u8 ep_num, struct urb *urb)
 		int unit_count;
 		int unit_size;
 		int rem;
-		if (ei == 0)
+		if (ei == NULL)
 			return -1;
 		rem = MAX_ISOC_FIXED_DATA;
 		elt = (struct oz_elt *)ei->data;
@@ -359,7 +359,7 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt)
 	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; /* Context has gone so nothing to do. */
 	if (usb_ctx->stopped)
 		goto done;
@@ -391,14 +391,14 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt)
 			struct oz_set_config_rsp *body =
 				(struct oz_set_config_rsp *)usb_hdr;
 			oz_hcd_control_cnf(usb_ctx->hport, body->req_id,
-				body->rcode, 0, 0);
+				body->rcode, NULL, 0);
 		}
 		break;
 	case OZ_SET_INTERFACE_RSP: {
 			struct oz_set_interface_rsp *body =
 				(struct oz_set_interface_rsp *)usb_hdr;
 			oz_hcd_control_cnf(usb_ctx->hport,
-				body->req_id, body->rcode, 0, 0);
+				body->req_id, body->rcode, NULL, 0);
 		}
 		break;
 	case OZ_VENDOR_CLASS_RSP: {
@@ -427,7 +427,7 @@ void oz_usb_farewell(struct oz_pd *pd, u8 ep_num, u8 *data, u8 len)
 	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; /* Context has gone so nothing to do. */
 	if (!usb_ctx->stopped) {
 		oz_trace("Farewell indicated ep = 0x%x\n", ep_num);
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 3/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer
  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 ` Peter Huewe
  2013-02-15  5:25 ` [PATCH 4/7] " Peter Huewe
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15  5:25 UTC (permalink / raw)
  To: Rupesh Gujare; +Cc: Greg Kroah-Hartman, devel, linux-kernel, Peter Huewe

This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/ozwpan/ozeltbuf.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/ozwpan/ozeltbuf.c b/drivers/staging/ozwpan/ozeltbuf.c
index 988f522..4c81f28 100644
--- a/drivers/staging/ozwpan/ozeltbuf.c
+++ b/drivers/staging/ozwpan/ozeltbuf.c
@@ -64,7 +64,7 @@ void oz_elt_buf_term(struct oz_elt_buf *buf)
  */
 struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf)
 {
-	struct oz_elt_info *ei = 0;
+	struct oz_elt_info *ei = NULL;
 	spin_lock_bh(&buf->lock);
 	if (buf->free_elts && buf->elt_pool) {
 		ei = container_of(buf->elt_pool, struct oz_elt_info, link);
@@ -82,9 +82,9 @@ struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf)
 	if (ei) {
 		ei->flags = 0;
 		ei->app_id = 0;
-		ei->callback = 0;
+		ei->callback = NULL;
 		ei->context = 0;
-		ei->stream = 0;
+		ei->stream = NULL;
 		ei->magic = OZ_ELT_INFO_MAGIC_USED;
 		INIT_LIST_HEAD(&ei->link);
 		INIT_LIST_HEAD(&ei->link_order);
@@ -135,7 +135,7 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count)
 	oz_trace("oz_elt_stream_create(0x%x)\n", id);
 
 	st = kzalloc(sizeof(struct oz_elt_stream), GFP_ATOMIC | __GFP_ZERO);
-	if (st == 0)
+	if (st == NULL)
 		return -ENOMEM;
 	atomic_set(&st->ref_count, 1);
 	st->id = id;
@@ -161,7 +161,7 @@ int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
 			list_del(e);
 			break;
 		}
-		st = 0;
+		st = NULL;
 	}
 	if (!st) {
 		spin_unlock_bh(&buf->lock);
@@ -208,7 +208,7 @@ void oz_elt_stream_put(struct oz_elt_stream *st)
 int oz_queue_elt_info(struct oz_elt_buf *buf, u8 isoc, u8 id,
 	struct oz_elt_info *ei)
 {
-	struct oz_elt_stream *st = 0;
+	struct oz_elt_stream *st = NULL;
 	struct list_head *e;
 	if (id) {
 		list_for_each(e, &buf->stream_list) {
@@ -297,7 +297,7 @@ int oz_select_elts_for_tx(struct oz_elt_buf *buf, u8 isoc, unsigned *len,
 					"Stream down: %d  %d\n",
 					ei->stream->buf_count, ei->length);
 				oz_elt_stream_put(ei->stream);
-				ei->stream = 0;
+				ei->stream = NULL;
 			}
 			INIT_LIST_HEAD(&ei->link_order);
 			list_add_tail(&ei->link, list);
@@ -319,7 +319,7 @@ int oz_are_elts_available(struct oz_elt_buf *buf)
  */
 void oz_trim_elt_pool(struct oz_elt_buf *buf)
 {
-	struct list_head *free = 0;
+	struct list_head *free = NULL;
 	struct list_head *e;
 	spin_lock_bh(&buf->lock);
 	while (buf->free_elts > buf->max_free_elts) {
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 4/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer
  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 ` Peter Huewe
  2013-02-15  5:25 ` [PATCH 5/7] " Peter Huewe
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15  5:25 UTC (permalink / raw)
  To: Rupesh Gujare; +Cc: Greg Kroah-Hartman, devel, linux-kernel, Peter Huewe

This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/ozwpan/ozproto.c |   78 +++++++++++++++++++-------------------
 1 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c
index e00a539..31857ab 100644
--- a/drivers/staging/ozwpan/ozproto.c
+++ b/drivers/staging/ozwpan/ozproto.c
@@ -98,7 +98,7 @@ static void oz_send_conn_rsp(struct oz_pd *pd, u8 status)
 	int sz = sizeof(struct oz_hdr) + sizeof(struct oz_elt) +
 			sizeof(struct oz_elt_connect_rsp);
 	skb = alloc_skb(sz + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC);
-	if (skb == 0)
+	if (skb == NULL)
 		return;
 	skb_reserve(skb, LL_RESERVED_SPACE(dev));
 	skb_reset_network_header(skb);
@@ -116,7 +116,7 @@ static void oz_send_conn_rsp(struct oz_pd *pd, u8 status)
 	oz_hdr->control = (OZ_PROTOCOL_VERSION<<OZ_VERSION_SHIFT);
 	oz_hdr->last_pkt_num = 0;
 	put_unaligned(0, &oz_hdr->pkt_num);
-	oz_event_log(OZ_EVT_CONNECT_RSP, 0, 0, 0, 0);
+	oz_event_log(OZ_EVT_CONNECT_RSP, 0, 0, NULL, 0);
 	elt->type = OZ_ELT_CONNECT_RSP;
 	elt->length = sizeof(struct oz_elt_connect_rsp);
 	memset(body, 0, sizeof(struct oz_elt_connect_rsp));
@@ -179,17 +179,17 @@ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt,
 	u8 rsp_status = OZ_STATUS_SUCCESS;
 	u8 stop_needed = 0;
 	u16 new_apps = g_apps;
-	struct net_device *old_net_dev = 0;
-	struct oz_pd *free_pd = 0;
+	struct net_device *old_net_dev = NULL;
+	struct oz_pd *free_pd = NULL;
 	if (cur_pd) {
 		pd = cur_pd;
 		spin_lock_bh(&g_polling_lock);
 	} else {
-		struct oz_pd *pd2 = 0;
+		struct oz_pd *pd2 = NULL;
 		struct list_head *e;
 		pd = oz_pd_alloc(pd_addr);
-		if (pd == 0)
-			return 0;
+		if (pd == NULL)
+			return NULL;
 		pd->last_rx_time_j = jiffies;
 		spin_lock_bh(&g_polling_lock);
 		list_for_each(e, &g_pd_list) {
@@ -203,9 +203,9 @@ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt,
 		if (pd != pd2)
 			list_add_tail(&pd->link, &g_pd_list);
 	}
-	if (pd == 0) {
+	if (pd == NULL) {
 		spin_unlock_bh(&g_polling_lock);
-		return 0;
+		return NULL;
 	}
 	if (pd->net_dev != net_dev) {
 		old_net_dev = pd->net_dev;
@@ -294,7 +294,7 @@ done:
 		if (stop_needed)
 			oz_pd_stop(pd);
 		oz_pd_put(pd);
-		pd = 0;
+		pd = NULL;
 	}
 	if (old_net_dev)
 		dev_put(old_net_dev);
@@ -340,14 +340,14 @@ static void oz_rx_frame(struct sk_buff *skb)
 	u8 *src_addr;
 	struct oz_elt *elt;
 	int length;
-	struct oz_pd *pd = 0;
+	struct oz_pd *pd = NULL;
 	struct oz_hdr *oz_hdr = (struct oz_hdr *)skb_network_header(skb);
 	int dup = 0;
 	u32 pkt_num;
 
 	oz_event_log(OZ_EVT_RX_PROCESS, 0,
 		(((u16)oz_hdr->control)<<8)|oz_hdr->last_pkt_num,
-		0, oz_hdr->pkt_num);
+		NULL, oz_hdr->pkt_num);
 	oz_trace2(OZ_TRACE_RX_FRAMES,
 		"RX frame PN=0x%x LPN=0x%x control=0x%x\n",
 		oz_hdr->pkt_num, oz_hdr->last_pkt_num, oz_hdr->control);
@@ -402,7 +402,7 @@ static void oz_rx_frame(struct sk_buff *skb)
 			break;
 		switch (elt->type) {
 		case OZ_ELT_CONNECT_REQ:
-			oz_event_log(OZ_EVT_CONNECT_REQ, 0, 0, 0, 0);
+			oz_event_log(OZ_EVT_CONNECT_REQ, 0, 0, NULL, 0);
 			oz_trace("RX: OZ_ELT_CONNECT_REQ\n");
 			pd = oz_connect_req(pd, elt, src_addr, skb->dev);
 			break;
@@ -456,7 +456,7 @@ done:
  */
 void oz_protocol_term(void)
 {
-	struct list_head *chain = 0;
+	struct list_head *chain = NULL;
 	del_timer_sync(&g_timer);
 	/* Walk the list of bindings and remove each one.
 	 */
@@ -487,7 +487,7 @@ void oz_protocol_term(void)
 		spin_lock_bh(&g_polling_lock);
 	}
 	chain = g_timer_pool;
-	g_timer_pool = 0;
+	g_timer_pool = NULL;
 	spin_unlock_bh(&g_polling_lock);
 	while (chain) {
 		struct oz_timer *t = container_of(chain, struct oz_timer, link);
@@ -534,25 +534,25 @@ static void oz_protocol_timer(unsigned long arg)
 		/* This happens if we remove the current timer but can't stop
 		 * the timer from firing. In this case just get out.
 		 */
-		oz_event_log(OZ_EVT_TIMER, 0, 0, 0, 0);
+		oz_event_log(OZ_EVT_TIMER, 0, 0, NULL, 0);
 		spin_unlock_bh(&g_polling_lock);
 		return;
 	}
 	g_timer_state = OZ_TIMER_IN_HANDLER;
 	t = g_cur_timer;
-	g_cur_timer = 0;
+	g_cur_timer = NULL;
 	list_del(&t->link);
 	spin_unlock_bh(&g_polling_lock);
 	do {
 		pd = t->pd;
-		oz_event_log(OZ_EVT_TIMER, 0, t->type, 0, 0);
+		oz_event_log(OZ_EVT_TIMER, 0, t->type, NULL, 0);
 		oz_pd_handle_timer(pd, t->type);
 		spin_lock_bh(&g_polling_lock);
 		if (g_timer_pool_count < OZ_MAX_TIMER_POOL_SIZE) {
 			t->link.next = g_timer_pool;
 			g_timer_pool = &t->link;
 			g_timer_pool_count++;
-			t = 0;
+			t = NULL;
 		}
 		if (!list_empty(&g_timer_list)) {
 			t2 =  container_of(g_timer_list.next,
@@ -560,9 +560,9 @@ static void oz_protocol_timer(unsigned long arg)
 			if (time_before_eq(t2->due_time, jiffies))
 				list_del(&t2->link);
 			else
-				t2 = 0;
+				t2 = NULL;
 		} else {
-			t2 = 0;
+			t2 = NULL;
 		}
 		spin_unlock_bh(&g_polling_lock);
 		oz_pd_put(pd);
@@ -583,12 +583,12 @@ static void oz_protocol_timer_start(void)
 			container_of(g_timer_list.next, struct oz_timer, link);
 		if (g_timer_state == OZ_TIMER_SET) {
 			oz_event_log(OZ_EVT_TIMER_CTRL, 3,
-				(u16)g_cur_timer->type, 0,
+				(u16)g_cur_timer->type, NULL,
 				(unsigned)g_cur_timer->due_time);
 			mod_timer(&g_timer, g_cur_timer->due_time);
 		} else {
 			oz_event_log(OZ_EVT_TIMER_CTRL, 4,
-				(u16)g_cur_timer->type, 0,
+				(u16)g_cur_timer->type, NULL,
 				(unsigned)g_cur_timer->due_time);
 			g_timer.expires = g_cur_timer->due_time;
 			g_timer.function = oz_protocol_timer;
@@ -608,9 +608,9 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time,
 		int remove)
 {
 	struct list_head *e;
-	struct oz_timer *t = 0;
+	struct oz_timer *t = NULL;
 	int restart_needed = 0;
-	oz_event_log(OZ_EVT_TIMER_CTRL, 1, (u16)type, 0, (unsigned)due_time);
+	oz_event_log(OZ_EVT_TIMER_CTRL, 1, (u16)type, NULL, (unsigned)due_time);
 	spin_lock(&g_polling_lock);
 	if (remove) {
 		list_for_each(e, &g_timer_list) {
@@ -618,12 +618,12 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time,
 			if ((t->pd == pd) && (t->type == type)) {
 				if (g_cur_timer == t) {
 					restart_needed = 1;
-					g_cur_timer = 0;
+					g_cur_timer = NULL;
 				}
 				list_del(e);
 				break;
 			}
-			t = 0;
+			t = NULL;
 		}
 	}
 	if (!t) {
@@ -647,7 +647,7 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time,
 			t2 = container_of(e, struct oz_timer, link);
 			if (time_before(due_time, t2->due_time)) {
 				if (t2 == g_cur_timer) {
-					g_cur_timer = 0;
+					g_cur_timer = NULL;
 					restart_needed = 1;
 				}
 				break;
@@ -668,18 +668,18 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time,
  */
 void oz_timer_delete(struct oz_pd *pd, int type)
 {
-	struct list_head *chain = 0;
+	struct list_head *chain = NULL;
 	struct oz_timer *t;
 	struct oz_timer *n;
 	int restart_needed = 0;
 	int release = 0;
-	oz_event_log(OZ_EVT_TIMER_CTRL, 2, (u16)type, 0, 0);
+	oz_event_log(OZ_EVT_TIMER_CTRL, 2, (u16)type, NULL, 0);
 	spin_lock(&g_polling_lock);
 	list_for_each_entry_safe(t, n, &g_timer_list, link) {
 		if ((t->pd == pd) && ((type == 0) || (t->type == type))) {
 			if (g_cur_timer == t) {
 				restart_needed = 1;
-				g_cur_timer = 0;
+				g_cur_timer = NULL;
 				del_timer(&g_timer);
 			}
 			list_del(&t->link);
@@ -748,7 +748,7 @@ struct oz_pd *oz_pd_find(u8 *mac_addr)
 		}
 	}
 	spin_unlock_bh(&g_polling_lock);
-	return 0;
+	return NULL;
 }
 /*------------------------------------------------------------------------------
  * Context: process
@@ -770,9 +770,9 @@ void oz_app_enable(int app_id, int enable)
 static int oz_pkt_recv(struct sk_buff *skb, struct net_device *dev,
 		struct packet_type *pt, struct net_device *orig_dev)
 {
-	oz_event_log(OZ_EVT_RX_FRAME, 0, 0, 0, 0);
+	oz_event_log(OZ_EVT_RX_FRAME, 0, 0, NULL, 0);
 	skb = skb_share_check(skb, GFP_ATOMIC);
-	if (skb == 0)
+	if (skb == NULL)
 		return 0;
 	spin_lock_bh(&g_rx_queue.lock);
 	if (g_processing_rx) {
@@ -815,14 +815,14 @@ void oz_binding_add(char *net_dev)
 			oz_trace("Adding binding: %s\n", net_dev);
 			binding->ptype.dev =
 				dev_get_by_name(&init_net, net_dev);
-			if (binding->ptype.dev == 0) {
+			if (binding->ptype.dev == NULL) {
 				oz_trace("Netdev %s not found\n", net_dev);
 				kfree(binding);
-				binding = 0;
+				binding = NULL;
 			}
 		} else {
 			oz_trace("Binding to all netcards\n");
-			binding->ptype.dev = 0;
+			binding->ptype.dev = NULL;
 		}
 		if (binding) {
 			dev_add_pack(&binding->ptype);
@@ -876,7 +876,7 @@ static void pd_stop_all_for_device(struct net_device *net_dev)
  */
 void oz_binding_remove(char *net_dev)
 {
-	struct oz_binding *binding = 0;
+	struct oz_binding *binding = NULL;
 	struct oz_binding **link;
 	oz_trace("Removing binding: %s\n", net_dev);
 	spin_lock_bh(&g_binding_lock);
@@ -923,7 +923,7 @@ int oz_protocol_init(char *devs)
 {
 	skb_queue_head_init(&g_rx_queue);
 	if (devs && (devs[0] == '*')) {
-		oz_binding_add(0);
+		oz_binding_add(NULL);
 	} else {
 		char d[32];
 		while (*devs) {
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 5/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer
  2013-02-15  5:25 [PATCH 1/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer Peter Huewe
                   ` (2 preceding siblings ...)
  2013-02-15  5:25 ` [PATCH 4/7] " Peter Huewe
@ 2013-02-15  5:25 ` Peter Huewe
  2013-02-15  5:25 ` [PATCH 6/7] " Peter Huewe
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15  5:25 UTC (permalink / raw)
  To: Rupesh Gujare; +Cc: Greg Kroah-Hartman, devel, linux-kernel, Peter Huewe

This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

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..5205617 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 = NULL;
 
 	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 = NULL;
 	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 = NULL;
+	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


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 6/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer
  2013-02-15  5:25 [PATCH 1/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer Peter Huewe
                   ` (3 preceding siblings ...)
  2013-02-15  5:25 ` [PATCH 5/7] " Peter Huewe
@ 2013-02-15  5:25 ` Peter Huewe
  2013-02-15  5:25 ` [PATCH 7/7] " Peter Huewe
  2013-02-15  8:45 ` [PATCH 1/7] " Dan Carpenter
  6 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15  5:25 UTC (permalink / raw)
  To: Rupesh Gujare; +Cc: Greg Kroah-Hartman, devel, linux-kernel, Peter Huewe

This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

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..e12343e 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 = NULL;
+	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


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 7/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer
  2013-02-15  5:25 [PATCH 1/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer Peter Huewe
                   ` (4 preceding siblings ...)
  2013-02-15  5:25 ` [PATCH 6/7] " Peter Huewe
@ 2013-02-15  5:25 ` Peter Huewe
  2013-02-15  8:45 ` [PATCH 1/7] " Dan Carpenter
  6 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15  5:25 UTC (permalink / raw)
  To: Rupesh Gujare; +Cc: Greg Kroah-Hartman, devel, linux-kernel, Peter Huewe

This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/ozwpan/ozhcd.c |  135 ++++++++++++++++++++--------------------
 1 files changed, 68 insertions(+), 67 deletions(-)

diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c
index 9154f33..b48663e 100644
--- a/drivers/staging/ozwpan/ozhcd.c
+++ b/drivers/staging/ozwpan/ozhcd.c
@@ -248,7 +248,7 @@ static int oz_get_port_from_addr(struct oz_hcd *ozhcd, u8 bus_addr)
  */
 static struct oz_urb_link *oz_alloc_urb_link(void)
 {
-	struct oz_urb_link *urbl = 0;
+	struct oz_urb_link *urbl = NULL;
 	unsigned long irq_state;
 	spin_lock_irqsave(&g_link_lock, irq_state);
 	if (g_link_pool) {
@@ -257,7 +257,7 @@ static struct oz_urb_link *oz_alloc_urb_link(void)
 		--g_link_pool_size;
 	}
 	spin_unlock_irqrestore(&g_link_lock, irq_state);
-	if (urbl == 0)
+	if (urbl == NULL)
 		urbl = kmalloc(sizeof(struct oz_urb_link), GFP_ATOMIC);
 	return urbl;
 }
@@ -274,7 +274,7 @@ static void oz_free_urb_link(struct oz_urb_link *urbl)
 		if (g_link_pool_size < OZ_MAX_LINK_POOL_SIZE) {
 			urbl->link.next = g_link_pool;
 			g_link_pool = &urbl->link;
-			urbl = 0;
+			urbl = NULL;
 			g_link_pool_size++;
 		}
 		spin_unlock_irqrestore(&g_link_lock, irq_state);
@@ -291,7 +291,7 @@ static void oz_empty_link_pool(void)
 	unsigned long irq_state;
 	spin_lock_irqsave(&g_link_lock, irq_state);
 	e = g_link_pool;
-	g_link_pool = 0;
+	g_link_pool = NULL;
 	g_link_pool_size = 0;
 	spin_unlock_irqrestore(&g_link_lock, irq_state);
 	while (e) {
@@ -337,7 +337,7 @@ struct oz_urb_link *oz_uncancel_urb(struct oz_hcd *ozhcd, struct urb *urb)
 			return urbl;
 		}
 	}
-	return 0;
+	return NULL;
 }
 /*------------------------------------------------------------------------------
  * This is called when we have finished processing an urb. It unlinks it from
@@ -349,13 +349,13 @@ static void oz_complete_urb(struct usb_hcd *hcd, struct urb *urb,
 {
 	struct oz_hcd *ozhcd = oz_hcd_private(hcd);
 	unsigned long irq_state;
-	struct oz_urb_link *cancel_urbl = 0;
+	struct oz_urb_link *cancel_urbl = NULL;
 	spin_lock_irqsave(&g_tasklet_lock, irq_state);
 	usb_hcd_unlink_urb_from_ep(hcd, urb);
 	/* Clear hcpriv which will prevent it being put in the cancel list
 	 * in the event that an attempt is made to cancel it.
 	 */
-	urb->hcpriv = 0;
+	urb->hcpriv = NULL;
 	/* Walk the cancel list in case the urb is already sitting there.
 	 * Since we process the cancel list in a tasklet rather than in
 	 * the dequeue function this could happen.
@@ -507,7 +507,7 @@ static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
 			ep->last_jiffies = jiffies;
 			ep->credit = 0;
 			oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num,
-					0, 0, ep->credit);
+					0, NULL, ep->credit);
 		}
 	} else {
 		err = -EPIPE;
@@ -525,7 +525,7 @@ static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
 static int oz_dequeue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
 			struct urb *urb)
 {
-	struct oz_urb_link *urbl = 0;
+	struct oz_urb_link *urbl = NULL;
 	struct oz_endpoint *ep;
 	spin_lock_bh(&port->ozhcd->hcd_lock);
 	if (in_dir)
@@ -540,7 +540,7 @@ static int oz_dequeue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
 				list_del_init(e);
 				break;
 			}
-			urbl = 0;
+			urbl = NULL;
 		}
 	}
 	spin_unlock_bh(&port->ozhcd->hcd_lock);
@@ -556,8 +556,8 @@ static struct urb *oz_find_urb_by_id(struct oz_port *port, int ep_ix,
 		u8 req_id)
 {
 	struct oz_hcd *ozhcd = port->ozhcd;
-	struct urb *urb = 0;
-	struct oz_urb_link *urbl = 0;
+	struct urb *urb = NULL;
+	struct oz_urb_link *urbl = NULL;
 	struct oz_endpoint *ep;
 
 	spin_lock_bh(&ozhcd->hcd_lock);
@@ -630,13 +630,13 @@ static inline void oz_hcd_put(struct oz_hcd *ozhcd)
 void *oz_hcd_pd_arrived(void *hpd)
 {
 	int i;
-	void *hport = 0;
-	struct oz_hcd *ozhcd = 0;
+	void *hport = NULL;
+	struct oz_hcd *ozhcd = NULL;
 	struct oz_endpoint *ep;
 	oz_trace("oz_hcd_pd_arrived()\n");
 	ozhcd = oz_hcd_claim();
-	if (ozhcd == 0)
-		return 0;
+	if (ozhcd == NULL)
+		return NULL;
 	/* Allocate an endpoint object in advance (before holding hcd lock) to
 	 * use for out endpoint 0.
 	 */
@@ -663,7 +663,7 @@ void *oz_hcd_pd_arrived(void *hpd)
 		/* Attach out endpoint 0.
 		 */
 		ozhcd->ports[i].out_ep[0] = ep;
-		ep = 0;
+		ep = NULL;
 		hport = &ozhcd->ports[i];
 		spin_unlock_bh(&ozhcd->hcd_lock);
 		if (ozhcd->flags & OZ_HDC_F_SUSPENDED) {
@@ -676,7 +676,7 @@ void *oz_hcd_pd_arrived(void *hpd)
 	}
 out:
 	if (ep) /* ep is non-null if not used. */
-		oz_ep_free(0, ep);
+		oz_ep_free(NULL, ep);
 	oz_hcd_put(ozhcd);
 	return hport;
 }
@@ -691,15 +691,15 @@ void oz_hcd_pd_departed(void *hport)
 	struct oz_port *port = (struct oz_port *)hport;
 	struct oz_hcd *ozhcd;
 	void *hpd;
-	struct oz_endpoint *ep = 0;
+	struct oz_endpoint *ep = NULL;
 
 	oz_trace("oz_hcd_pd_departed()\n");
-	if (port == 0) {
+	if (port == NULL) {
 		oz_trace("oz_hcd_pd_departed() port = 0\n");
 		return;
 	}
 	ozhcd = port->ozhcd;
-	if (ozhcd == 0)
+	if (ozhcd == NULL)
 		return;
 	/* Check if this is the connection port - if so clear it.
 	 */
@@ -717,7 +717,7 @@ void oz_hcd_pd_departed(void *hport)
 	oz_clean_endpoints_for_config(ozhcd->hcd, port);
 	spin_lock_bh(&port->port_lock);
 	hpd = port->hpd;
-	port->hpd = 0;
+	port->hpd = NULL;
 	port->bus_addr = 0xff;
 	port->flags &= ~(OZ_PORT_F_PRESENT | OZ_PORT_F_DYING);
 	port->flags |= OZ_PORT_F_CHANGED;
@@ -728,7 +728,7 @@ void oz_hcd_pd_departed(void *hport)
 	 */
 	if (port->out_ep[0]) {
 		ep = port->out_ep[0];
-		port->out_ep[0] = 0;
+		port->out_ep[0] = NULL;
 	}
 	spin_unlock_bh(&port->port_lock);
 	if (ep)
@@ -764,7 +764,7 @@ void oz_hcd_get_desc_cnf(void *hport, u8 req_id, int status, u8 *desc,
 	struct urb *urb;
 	int err = 0;
 
-	oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, 0, status);
+	oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, NULL, status);
 	oz_trace("oz_hcd_get_desc_cnf length = %d offs = %d tot_size = %d\n",
 			length, offset, total_size);
 	urb = oz_find_urb_by_id(port, 0, req_id);
@@ -903,7 +903,7 @@ void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, u8 *data,
 	unsigned windex;
 	unsigned wvalue;
 
-	oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, 0, rcode);
+	oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, NULL, rcode);
 	oz_trace("oz_hcd_control_cnf rcode=%u len=%d\n", rcode, data_len);
 	urb = oz_find_urb_by_id(port, 0, req_id);
 	if (!urb) {
@@ -988,7 +988,7 @@ void oz_hcd_data_ind(void *hport, u8 endpoint, u8 *data, int data_len)
 	struct oz_hcd *ozhcd = port->ozhcd;
 	spin_lock_bh(&ozhcd->hcd_lock);
 	ep = port->in_ep[endpoint & USB_ENDPOINT_NUMBER_MASK];
-	if (ep == 0)
+	if (ep == NULL)
 		goto done;
 	switch (ep->attrib & USB_ENDPOINT_XFERTYPE_MASK) {
 	case USB_ENDPOINT_XFER_INT:
@@ -1056,7 +1056,8 @@ int oz_hcd_heartbeat(void *hport)
 		ep->credit += jiffies_to_msecs(now - ep->last_jiffies);
 		if (ep->credit > ep->credit_ceiling)
 			ep->credit = ep->credit_ceiling;
-		oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0, ep->credit);
+		oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, NULL,
+			     ep->credit);
 		ep->last_jiffies = now;
 		while (ep->credit && !list_empty(&ep->urb_list)) {
 			urbl = list_first_entry(&ep->urb_list,
@@ -1065,8 +1066,8 @@ int oz_hcd_heartbeat(void *hport)
 			if ((ep->credit + 1) < urb->number_of_packets)
 				break;
 			ep->credit -= urb->number_of_packets;
-			oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0,
-				ep->credit);
+			oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, NULL,
+				     ep->credit);
 			list_move_tail(&urbl->link, &xfr_list);
 		}
 	}
@@ -1096,17 +1097,17 @@ int oz_hcd_heartbeat(void *hport)
 				ep->credit = 0;
 				oz_event_log(OZ_EVT_EP_CREDIT,
 					ep->ep_num | USB_DIR_IN,
-					0, 0, ep->credit);
+					0, NULL, ep->credit);
 				ep->last_jiffies = now;
 				ep->start_frame = 0;
 				oz_event_log(OZ_EVT_EP_BUFFERING,
-					ep->ep_num | USB_DIR_IN, 0, 0, 0);
+					ep->ep_num | USB_DIR_IN, 0, NULL, 0);
 			}
 			continue;
 		}
 		ep->credit += jiffies_to_msecs(now - ep->last_jiffies);
 		oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num | USB_DIR_IN,
-			0, 0, ep->credit);
+			0, NULL, ep->credit);
 		ep->last_jiffies = now;
 		while (!list_empty(&ep->urb_list)) {
 			struct oz_urb_link *urbl =
@@ -1151,7 +1152,7 @@ int oz_hcd_heartbeat(void *hport)
 			list_move_tail(&urbl->link, &xfr_list);
 			ep->credit -= urb->number_of_packets;
 			oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num | USB_DIR_IN,
-				0, 0, ep->credit);
+				0, NULL, ep->credit);
 		}
 	}
 	if (!list_empty(&port->isoc_out_ep) || !list_empty(&port->isoc_in_ep))
@@ -1244,7 +1245,7 @@ static int oz_build_endpoints_for_interface(struct usb_hcd *hcd,
 			if (ep_addr & USB_ENDPOINT_DIR_MASK) {
 				ep->flags |= OZ_F_EP_BUFFERING;
 				oz_event_log(OZ_EVT_EP_BUFFERING,
-					ep->ep_num | USB_DIR_IN, 1, 0, 0);
+					ep->ep_num | USB_DIR_IN, 1, NULL, 0);
 			} else {
 				ep->flags |= OZ_F_EP_HAVE_STREAM;
 				if (oz_usb_stream_create(port->hpd, ep_num))
@@ -1300,7 +1301,7 @@ static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd,
 		 */
 		if ((mask & (1<<i)) && port->out_ep[i]) {
 			e = &port->out_ep[i]->link;
-			port->out_ep[i] = 0;
+			port->out_ep[i] = NULL;
 			/* Remove from isoc list if present.
 			 */
 			list_move_tail(e, &ep_list);
@@ -1309,7 +1310,7 @@ static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd,
 		 */
 		if ((mask & (1<<(i+OZ_NB_ENDPOINTS))) && port->in_ep[i]) {
 			e = &port->in_ep[i]->link;
-			port->in_ep[i] = 0;
+			port->in_ep[i] = NULL;
 			list_move_tail(e, &ep_list);
 		}
 	}
@@ -1370,7 +1371,7 @@ static void oz_clean_endpoints_for_config(struct usb_hcd *hcd,
 	if (port->iface) {
 		oz_trace("Freeing interfaces object.\n");
 		kfree(port->iface);
-		port->iface = 0;
+		port->iface = NULL;
 	}
 	port->num_iface = 0;
 	spin_unlock_bh(&ozhcd->hcd_lock);
@@ -1380,7 +1381,7 @@ static void oz_clean_endpoints_for_config(struct usb_hcd *hcd,
  */
 static void *oz_claim_hpd(struct oz_port *port)
 {
-	void *hpd = 0;
+	void *hpd = NULL;
 	struct oz_hcd *ozhcd = port->ozhcd;
 	spin_lock_bh(&ozhcd->hcd_lock);
 	hpd = port->hpd;
@@ -1399,13 +1400,13 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
 	unsigned windex;
 	unsigned wvalue;
 	unsigned wlength;
-	void *hpd = 0;
+	void *hpd = NULL;
 	u8 req_id;
 	int rc = 0;
 	unsigned complete = 0;
 
 	int port_ix = -1;
-	struct oz_port *port = 0;
+	struct oz_port *port = NULL;
 
 	oz_trace2(OZ_TRACE_URB, "%lu: oz_process_ep0_urb(%p)\n", jiffies, urb);
 	port_ix = oz_get_port_from_addr(ozhcd, urb->dev->devnum);
@@ -1437,7 +1438,7 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
 
 	req_id = port->next_req_id++;
 	hpd = oz_claim_hpd(port);
-	if (hpd == 0) {
+	if (hpd == NULL) {
 		oz_trace("Cannot claim port\n");
 		rc = -EPIPE;
 		goto out;
@@ -1452,7 +1453,7 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
 			break;
 		case USB_REQ_SET_ADDRESS:
 			oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest,
-				0, 0, setup->bRequestType);
+				0, NULL, setup->bRequestType);
 			oz_trace("USB_REQ_SET_ADDRESS - req\n");
 			oz_trace("Port %d address is 0x%x\n", ozhcd->conn_port,
 				(u8)le16_to_cpu(setup->wValue));
@@ -1473,8 +1474,8 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
 			/* We short circuit this case and reply directly since
 			 * we have the selected configuration number cached.
 			 */
-			oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0, 0,
-				setup->bRequestType);
+			oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0,
+				     NULL, setup->bRequestType);
 			oz_trace("USB_REQ_GET_CONFIGURATION - reply now\n");
 			if (urb->transfer_buffer_length >= 1) {
 				urb->actual_length = 1;
@@ -1489,8 +1490,8 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
 			/* We short circuit this case and reply directly since
 			 * we have the selected interface alternative cached.
 			 */
-			oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0, 0,
-				setup->bRequestType);
+			oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0,
+				     NULL, setup->bRequestType);
 			oz_trace("USB_REQ_GET_INTERFACE - reply now\n");
 			if (urb->transfer_buffer_length >= 1) {
 				urb->actual_length = 1;
@@ -1583,7 +1584,7 @@ static void oz_urb_process_tasklet(unsigned long unused)
 	struct urb *urb;
 	struct oz_hcd *ozhcd = oz_hcd_claim();
 	int rc = 0;
-	if (ozhcd == 0)
+	if (ozhcd == NULL)
 		return;
 	/* This is called from a tasklet so is in softirq context but the urb
 	 * list is filled from any context so we need to lock
@@ -1617,17 +1618,17 @@ static void oz_urb_process_tasklet(unsigned long unused)
  */
 static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
 {
-	struct oz_urb_link *urbl = 0;
+	struct oz_urb_link *urbl = NULL;
 	struct list_head *e;
 	struct oz_hcd *ozhcd;
 	unsigned long irq_state;
 	u8 ix;
-	if (port == 0) {
+	if (port == NULL) {
 		oz_trace("ERRORERROR: oz_urb_cancel(%p) port is null\n", urb);
 		return;
 	}
 	ozhcd = port->ozhcd;
-	if (ozhcd == 0) {
+	if (ozhcd == NULL) {
 		oz_trace("ERRORERROR: oz_urb_cancel(%p) ozhcd is null\n", urb);
 		return;
 	}
@@ -1644,7 +1645,7 @@ static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
 		}
 	}
 	spin_unlock_irqrestore(&g_tasklet_lock, irq_state);
-	urbl = 0;
+	urbl = NULL;
 
 	/* Look in the orphanage.
 	 */
@@ -1658,7 +1659,7 @@ static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
 		}
 	}
 	ix = (ep_num & 0xf);
-	urbl = 0;
+	urbl = NULL;
 	if ((ep_num & USB_DIR_IN) && ix)
 		urbl = oz_remove_urb(port->in_ep[ix], urb);
 	else
@@ -1680,7 +1681,7 @@ static void oz_urb_cancel_tasklet(unsigned long unused)
 	unsigned long irq_state;
 	struct urb *urb;
 	struct oz_hcd *ozhcd = oz_hcd_claim();
-	if (ozhcd == 0)
+	if (ozhcd == NULL)
 		return;
 	spin_lock_irqsave(&g_tasklet_lock, irq_state);
 	while (!list_empty(&ozhcd->urb_cancel_list)) {
@@ -1772,7 +1773,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
 		jiffies, urb);
 	oz_event_log(OZ_EVT_URB_SUBMIT, oz_get_irq_ctx(),
 		(u16)urb->number_of_packets, urb, urb->pipe);
-	if (unlikely(ozhcd == 0)) {
+	if (unlikely(ozhcd == NULL)) {
 		oz_trace2(OZ_TRACE_URB, "%lu: Refused urb(%p) not ozhcd.\n",
 			jiffies, urb);
 		return -EPIPE;
@@ -1786,7 +1787,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
 	if (port_ix < 0)
 		return -EPIPE;
 	port =  &ozhcd->ports[port_ix];
-	if (port == 0)
+	if (port == NULL)
 		return -EPIPE;
 	if ((port->flags & OZ_PORT_F_PRESENT) == 0) {
 		oz_trace("Refusing URB port_ix = %d devnum = %d\n",
@@ -1797,7 +1798,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
 	/* Put request in queue for processing by tasklet.
 	 */
 	urbl = oz_alloc_urb_link();
-	if (unlikely(urbl == 0))
+	if (unlikely(urbl == NULL))
 		return -ENOMEM;
 	urbl->urb = urb;
 	spin_lock_irqsave(&g_tasklet_lock, irq_state);
@@ -1819,10 +1820,10 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
 static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep,
 				struct urb *urb)
 {
-	struct oz_urb_link *urbl = 0;
+	struct oz_urb_link *urbl = NULL;
 	struct list_head *e;
-	if (unlikely(ep == 0))
-		return 0;
+	if (unlikely(ep == NULL))
+		return NULL;
 	list_for_each(e, &ep->urb_list) {
 		urbl = container_of(e, struct oz_urb_link, link);
 		if (urbl->urb == urb) {
@@ -1834,12 +1835,12 @@ static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep,
 				oz_event_log(OZ_EVT_EP_CREDIT,
 					usb_pipein(urb->pipe) ?
 					(ep->ep_num | USB_DIR_IN) : ep->ep_num,
-					0, 0, ep->credit);
+					0, NULL, ep->credit);
 			}
 			return urbl;
 		}
 	}
-	return 0;
+	return NULL;
 }
 /*------------------------------------------------------------------------------
  * Called to dequeue a previously submitted urb for the device.
@@ -1848,12 +1849,12 @@ static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep,
 static int oz_hcd_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
 {
 	struct oz_hcd *ozhcd = oz_hcd_private(hcd);
-	struct oz_urb_link *urbl = 0;
+	struct oz_urb_link *urbl = NULL;
 	int rc;
 	unsigned long irq_state;
 	oz_trace2(OZ_TRACE_URB, "%lu: oz_hcd_urb_dequeue(%p)\n", jiffies, urb);
 	urbl = oz_alloc_urb_link();
-	if (unlikely(urbl == 0))
+	if (unlikely(urbl == NULL))
 		return -ENOMEM;
 	spin_lock_irqsave(&g_tasklet_lock, irq_state);
 	/* The following function checks the urb is still in the queue
@@ -2193,7 +2194,7 @@ static int oz_plat_probe(struct platform_device *dev)
 	struct oz_hcd *ozhcd;
 	oz_trace("oz_plat_probe()\n");
 	hcd = usb_create_hcd(&g_oz_hc_drv, &dev->dev, dev_name(&dev->dev));
-	if (hcd == 0) {
+	if (hcd == NULL) {
 		oz_trace("Failed to created hcd object OK\n");
 		return -ENOMEM;
 	}
@@ -2232,12 +2233,12 @@ static int oz_plat_remove(struct platform_device *dev)
 	struct usb_hcd *hcd = platform_get_drvdata(dev);
 	struct oz_hcd *ozhcd;
 	oz_trace("oz_plat_remove()\n");
-	if (hcd == 0)
+	if (hcd == NULL)
 		return -1;
 	ozhcd = oz_hcd_private(hcd);
 	spin_lock_bh(&g_hcdlock);
 	if (ozhcd == g_ozhcd)
-		g_ozhcd = 0;
+		g_ozhcd = NULL;
 	spin_unlock_bh(&g_hcdlock);
 	oz_trace("Clearing orphanage\n");
 	oz_hcd_clear_orphanage(ozhcd, -EPIPE);
@@ -2278,7 +2279,7 @@ int oz_hcd_init(void)
 	if (err)
 		goto error;
 	g_plat_dev = platform_device_alloc(OZ_PLAT_DEV_NAME, -1);
-	if (g_plat_dev == 0) {
+	if (g_plat_dev == NULL) {
 		err = -ENOMEM;
 		goto error1;
 	}
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 1/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer
  2013-02-15  5:25 [PATCH 1/7] staging/ozwpan: Fix sparse warning Using plain integer as NULL pointer Peter Huewe
                   ` (5 preceding siblings ...)
  2013-02-15  5:25 ` [PATCH 7/7] " Peter Huewe
@ 2013-02-15  8:45 ` Dan Carpenter
  2013-02-15 14:22   ` [PATCH 1/7 v2] staging/ozwpan: Fix NULL vs zero in ozpd.c (sparse warning) Peter Huewe
  6 siblings, 1 reply; 24+ messages in thread
From: Dan Carpenter @ 2013-02-15  8:45 UTC (permalink / raw)
  To: Peter Huewe; +Cc: Rupesh Gujare, devel, Greg Kroah-Hartman, linux-kernel

On Fri, Feb 15, 2013 at 06:25:29AM +0100, Peter Huewe wrote:
> This patch fixes the warning "Using plain integer as NULL pointer",
> generated by sparse, by replacing the offending 0s with NULL.
> 
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>

Don't send 7 patches with the same subject.

> @@ -455,7 +455,7 @@ int oz_prepare_frame(struct oz_pd *pd, int empty)
>   */
>  static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f)
>  {
> -	struct sk_buff *skb = 0;
> +	struct sk_buff *skb = NULL;

This initialization could just be removed.

>  	struct net_device *dev = pd->net_dev;
>  	struct oz_hdr *oz_hdr;
>  	struct oz_elt *elt;
> @@ -464,8 +464,8 @@ static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f)
>  	 * as the space we need.
>  	 */
>  	skb = alloc_skb(f->total_size + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC);
> -	if (skb == 0)
> -		return 0;
> +	if (skb == NULL)
> +		return NULL;

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 1/7 v2] staging/ozwpan: Fix NULL vs zero in ozpd.c (sparse warning)
  2013-02-15  8:45 ` [PATCH 1/7] " Dan Carpenter
@ 2013-02-15 14:22   ` Peter Huewe
  2013-02-15 14:22     ` [PATCH 2/7 v2] staging/ozwpan: Fix NULL vs zero in ozusbsvc1.c " Peter Huewe
                       ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15 14:22 UTC (permalink / raw)
  To: Rupesh Gujare
  Cc: Greg Kroah-Hartman, devel, linux-kernel, Dan Carpenter, Peter Huewe

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/ozpd.c |   68 ++++++++++++++++++++--------------------
 1 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c
index 118a4db..d969ed7 100644
--- a/drivers/staging/ozwpan/ozpd.c
+++ b/drivers/staging/ozwpan/ozpd.c
@@ -61,8 +61,8 @@ static struct oz_app_if g_app_if[OZ_APPID_MAX] = {
 	oz_def_app_start,
 	oz_def_app_stop,
 	oz_def_app_rx,
-	0,
-	0,
+	NULL,
+	NULL,
 	OZ_APPID_UNUSED1},
 
 	{oz_def_app_init,
@@ -70,8 +70,8 @@ static struct oz_app_if g_app_if[OZ_APPID_MAX] = {
 	oz_def_app_start,
 	oz_def_app_stop,
 	oz_def_app_rx,
-	0,
-	0,
+	NULL,
+	NULL,
 	OZ_APPID_UNUSED2},
 
 	{oz_cdev_init,
@@ -79,8 +79,8 @@ static struct oz_app_if g_app_if[OZ_APPID_MAX] = {
 	oz_cdev_start,
 	oz_cdev_stop,
 	oz_cdev_rx,
-	0,
-	0,
+	NULL,
+	NULL,
 	OZ_APPID_SERIAL},
 };
 /*------------------------------------------------------------------------------
@@ -121,7 +121,7 @@ static void oz_def_app_rx(struct oz_pd *pd, struct oz_elt *elt)
 void oz_pd_set_state(struct oz_pd *pd, unsigned state)
 {
 	pd->state = state;
-	oz_event_log(OZ_EVT_PD_STATE, 0, 0, 0, state);
+	oz_event_log(OZ_EVT_PD_STATE, 0, 0, NULL, state);
 #ifdef WANT_TRACE
 	switch (state) {
 	case OZ_PD_S_IDLE:
@@ -171,7 +171,7 @@ struct oz_pd *oz_pd_alloc(u8 *mac_addr)
 		memcpy(pd->mac_addr, mac_addr, ETH_ALEN);
 		if (0 != oz_elt_buf_init(&pd->elt_buff)) {
 			kfree(pd);
-			pd = 0;
+			pd = NULL;
 		}
 		spin_lock_init(&pd->tx_frame_lock);
 		INIT_LIST_HEAD(&pd->tx_queue);
@@ -355,7 +355,7 @@ int oz_pd_sleep(struct oz_pd *pd)
  */
 static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd)
 {
-	struct oz_tx_frame *f = 0;
+	struct oz_tx_frame *f = NULL;
 	spin_lock_bh(&pd->tx_frame_lock);
 	if (pd->tx_pool) {
 		f = container_of(pd->tx_pool, struct oz_tx_frame, link);
@@ -363,7 +363,7 @@ static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd)
 		pd->tx_pool_count--;
 	}
 	spin_unlock_bh(&pd->tx_frame_lock);
-	if (f == 0)
+	if (f == NULL)
 		f = kmalloc(sizeof(struct oz_tx_frame), GFP_ATOMIC);
 	if (f) {
 		f->total_size = sizeof(struct oz_hdr);
@@ -399,7 +399,7 @@ static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f)
 		f->link.next = pd->tx_pool;
 		pd->tx_pool = &f->link;
 		pd->tx_pool_count++;
-		f = 0;
+		f = NULL;
 	}
 	spin_unlock_bh(&pd->tx_frame_lock);
 	kfree(f);
@@ -433,7 +433,7 @@ int oz_prepare_frame(struct oz_pd *pd, int empty)
 	if (!empty && !oz_are_elts_available(&pd->elt_buff))
 		return -1;
 	f = oz_tx_frame_alloc(pd);
-	if (f == 0)
+	if (f == NULL)
 		return -1;
 	f->skb = NULL;
 	f->hdr.control =
@@ -455,7 +455,7 @@ int oz_prepare_frame(struct oz_pd *pd, int empty)
  */
 static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f)
 {
-	struct sk_buff *skb = 0;
+	struct sk_buff *skb;
 	struct net_device *dev = pd->net_dev;
 	struct oz_hdr *oz_hdr;
 	struct oz_elt *elt;
@@ -464,8 +464,8 @@ static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f)
 	 * as the space we need.
 	 */
 	skb = alloc_skb(f->total_size + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC);
-	if (skb == 0)
-		return 0;
+	if (skb == NULL)
+		return NULL;
 	/* Reserve the head room for lower layers.
 	 */
 	skb_reserve(skb, LL_RESERVED_SPACE(dev));
@@ -492,7 +492,7 @@ static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f)
 	return skb;
 fail:
 	kfree_skb(skb);
-	return 0;
+	return NULL;
 }
 /*------------------------------------------------------------------------------
  * Context: softirq or process
@@ -544,7 +544,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data)
 			if (dev_queue_xmit(skb) < 0) {
 				oz_trace2(OZ_TRACE_TX_FRAMES,
 						"Dropping ISOC Frame\n");
-				oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0);
+				oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0);
 				return -1;
 			}
 			atomic_inc(&g_submitted_isoc);
@@ -555,7 +555,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data)
 		} else {
 			kfree_skb(skb);
 			oz_trace2(OZ_TRACE_TX_FRAMES, "Dropping ISOC Frame>\n");
-			oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0);
+			oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0);
 			return -1;
 		}
 	}
@@ -570,7 +570,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data)
 		oz_event_log(OZ_EVT_TX_FRAME,
 			0,
 			(((u16)f->hdr.control)<<8)|f->hdr.last_pkt_num,
-			0, f->hdr.pkt_num);
+			NULL, f->hdr.pkt_num);
 		if (dev_queue_xmit(skb) < 0)
 			return -1;
 
@@ -620,7 +620,7 @@ out:	oz_prepare_frame(pd, 1);
  */
 static int oz_send_isoc_frame(struct oz_pd *pd)
 {
-	struct sk_buff *skb = 0;
+	struct sk_buff *skb;
 	struct net_device *dev = pd->net_dev;
 	struct oz_hdr *oz_hdr;
 	struct oz_elt *elt;
@@ -634,7 +634,7 @@ static int oz_send_isoc_frame(struct oz_pd *pd)
 	if (list.next == &list)
 		return 0;
 	skb = alloc_skb(total_size + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC);
-	if (skb == 0) {
+	if (skb == NULL) {
 		oz_trace("Cannot alloc skb\n");
 		oz_elt_info_free_chain(&pd->elt_buff, &list);
 		return -1;
@@ -659,7 +659,7 @@ static int oz_send_isoc_frame(struct oz_pd *pd)
 		memcpy(elt, ei->data, ei->length);
 		elt = oz_next_elt(elt);
 	}
-	oz_event_log(OZ_EVT_TX_ISOC, 0, 0, 0, 0);
+	oz_event_log(OZ_EVT_TX_ISOC, 0, 0, NULL, 0);
 	dev_queue_xmit(skb);
 	oz_elt_info_free_chain(&pd->elt_buff, &list);
 	return 0;
@@ -671,8 +671,8 @@ void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn)
 {
 	struct list_head *e;
 	struct oz_tx_frame *f;
-	struct list_head *first = 0;
-	struct list_head *last = 0;
+	struct list_head *first = NULL;
+	struct list_head *last = NULL;
 	u8 diff;
 	u32 pkt_num;
 
@@ -686,7 +686,7 @@ void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn)
 			break;
 		oz_trace2(OZ_TRACE_TX_FRAMES, "Releasing pkt_num= %u, nb= %d\n",
 						 pkt_num, pd->nb_queued_frames);
-		if (first == 0)
+		if (first == NULL)
 			first = e;
 		last = e;
 		e = e->next;
@@ -695,7 +695,7 @@ void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn)
 	if (first) {
 		last->next->prev = &pd->tx_queue;
 		pd->tx_queue.next = last->next;
-		last->next = 0;
+		last->next = NULL;
 	}
 	pd->last_sent_frame = &pd->tx_queue;
 	spin_unlock(&pd->tx_frame_lock);
@@ -718,7 +718,7 @@ static struct oz_isoc_stream *pd_stream_find(struct oz_pd *pd, u8 ep_num)
 		if (st->ep_num == ep_num)
 			return st;
 	}
-	return 0;
+	return NULL;
 }
 /*------------------------------------------------------------------------------
  * Context: softirq
@@ -733,7 +733,7 @@ int oz_isoc_stream_create(struct oz_pd *pd, u8 ep_num)
 	spin_lock_bh(&pd->stream_lock);
 	if (!pd_stream_find(pd, ep_num)) {
 		list_add(&st->link, &pd->stream_list);
-		st = 0;
+		st = NULL;
 	}
 	spin_unlock_bh(&pd->stream_lock);
 	kfree(st);
@@ -779,14 +779,14 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len)
 	struct net_device *dev = pd->net_dev;
 	struct oz_isoc_stream *st;
 	u8 nb_units = 0;
-	struct sk_buff *skb = 0;
-	struct oz_hdr *oz_hdr = 0;
+	struct sk_buff *skb = NULL;
+	struct oz_hdr *oz_hdr = NULL;
 	int size = 0;
 	spin_lock_bh(&pd->stream_lock);
 	st = pd_stream_find(pd, ep_num);
 	if (st) {
 		skb = st->skb;
-		st->skb = 0;
+		st->skb = NULL;
 		nb_units = st->nb_units;
 		st->nb_units = 0;
 		oz_hdr = st->oz_hdr;
@@ -799,7 +799,7 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len)
 		/* Allocate enough space for max size frame. */
 		skb = alloc_skb(pd->max_tx_size + OZ_ALLOCATED_SPACE(dev),
 				GFP_ATOMIC);
-		if (skb == 0)
+		if (skb == NULL)
 			return 0;
 		/* Reserve the head room for lower layers. */
 		skb_reserve(skb, LL_RESERVED_SPACE(dev));
@@ -874,13 +874,13 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len)
 			oz_event_log(OZ_EVT_TX_ISOC, nb_units, iso.frame_number,
 					skb, atomic_read(&g_submitted_isoc));
 			if (dev_queue_xmit(skb) < 0) {
-				oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0);
+				oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0);
 				return -1;
 			} else
 				return 0;
 		}
 
-out:	oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0);
+out:	oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0);
 	kfree_skb(skb);
 	return -1;
 
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 2/7 v2] staging/ozwpan: Fix NULL vs zero in ozusbsvc1.c (sparse warning)
  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     ` Peter Huewe
  2013-02-15 14:22     ` [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c " Peter Huewe
                       ` (5 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15 14:22 UTC (permalink / raw)
  To: Rupesh Gujare
  Cc: Greg Kroah-Hartman, devel, linux-kernel, Dan Carpenter, Peter Huewe

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/ozusbsvc1.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/ozwpan/ozusbsvc1.c b/drivers/staging/ozwpan/ozusbsvc1.c
index 66bd576..ea4a238b 100644
--- a/drivers/staging/ozwpan/ozusbsvc1.c
+++ b/drivers/staging/ozwpan/ozusbsvc1.c
@@ -71,7 +71,7 @@ int oz_usb_get_desc_req(void *hpd, u8 req_id, u8 req_type, u8 desc_type,
 	oz_trace("    len = 0x%x\n", len);
 	if (len > 200)
 		len = 200;
-	if (ei == 0)
+	if (ei == NULL)
 		return -1;
 	elt = (struct oz_elt *)ei->data;
 	elt->length = sizeof(struct oz_get_desc_req);
@@ -97,7 +97,7 @@ static int oz_usb_set_config_req(void *hpd, u8 req_id, u8 index)
 	struct oz_elt_buf *eb = &pd->elt_buff;
 	struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
 	struct oz_set_config_req *body;
-	if (ei == 0)
+	if (ei == NULL)
 		return -1;
 	elt = (struct oz_elt *)ei->data;
 	elt->length = sizeof(struct oz_set_config_req);
@@ -118,7 +118,7 @@ static int oz_usb_set_interface_req(void *hpd, u8 req_id, u8 index, u8 alt)
 	struct oz_elt_buf *eb = &pd->elt_buff;
 	struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
 	struct oz_set_interface_req *body;
-	if (ei == 0)
+	if (ei == NULL)
 		return -1;
 	elt = (struct oz_elt *)ei->data;
 	elt->length = sizeof(struct oz_set_interface_req);
@@ -141,7 +141,7 @@ static int oz_usb_set_clear_feature_req(void *hpd, u8 req_id, u8 type,
 	struct oz_elt_buf *eb = &pd->elt_buff;
 	struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
 	struct oz_feature_req *body;
-	if (ei == 0)
+	if (ei == NULL)
 		return -1;
 	elt = (struct oz_elt *)ei->data;
 	elt->length = sizeof(struct oz_feature_req);
@@ -165,7 +165,7 @@ static int oz_usb_vendor_class_req(void *hpd, u8 req_id, u8 req_type,
 	struct oz_elt_buf *eb = &pd->elt_buff;
 	struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff);
 	struct oz_vendor_class_req *body;
-	if (ei == 0)
+	if (ei == NULL)
 		return -1;
 	elt = (struct oz_elt *)ei->data;
 	elt->length = sizeof(struct oz_vendor_class_req) - 1 + data_len;
@@ -264,7 +264,7 @@ int oz_usb_send_isoc(void *hpd, u8 ep_num, struct urb *urb)
 		int unit_count;
 		int unit_size;
 		int rem;
-		if (ei == 0)
+		if (ei == NULL)
 			return -1;
 		rem = MAX_ISOC_FIXED_DATA;
 		elt = (struct oz_elt *)ei->data;
@@ -359,7 +359,7 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt)
 	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; /* Context has gone so nothing to do. */
 	if (usb_ctx->stopped)
 		goto done;
@@ -391,14 +391,14 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt)
 			struct oz_set_config_rsp *body =
 				(struct oz_set_config_rsp *)usb_hdr;
 			oz_hcd_control_cnf(usb_ctx->hport, body->req_id,
-				body->rcode, 0, 0);
+				body->rcode, NULL, 0);
 		}
 		break;
 	case OZ_SET_INTERFACE_RSP: {
 			struct oz_set_interface_rsp *body =
 				(struct oz_set_interface_rsp *)usb_hdr;
 			oz_hcd_control_cnf(usb_ctx->hport,
-				body->req_id, body->rcode, 0, 0);
+				body->req_id, body->rcode, NULL, 0);
 		}
 		break;
 	case OZ_VENDOR_CLASS_RSP: {
@@ -427,7 +427,7 @@ void oz_usb_farewell(struct oz_pd *pd, u8 ep_num, u8 *data, u8 len)
 	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; /* Context has gone so nothing to do. */
 	if (!usb_ctx->stopped) {
 		oz_trace("Farewell indicated ep = 0x%x\n", ep_num);
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning)
  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     ` Peter Huewe
  2013-02-15 14:52       ` Dan Carpenter
  2013-02-15 14:22     ` [PATCH 4/7 v2] staging/ozwpan: Fix NULL vs zero in ozproto.c (sparse warning) Peter Huewe
                       ` (4 subsequent siblings)
  6 siblings, 1 reply; 24+ messages in thread
From: Peter Huewe @ 2013-02-15 14:22 UTC (permalink / raw)
  To: Rupesh Gujare
  Cc: Greg Kroah-Hartman, devel, linux-kernel, Dan Carpenter, Peter Huewe

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/ozeltbuf.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ozwpan/ozeltbuf.c b/drivers/staging/ozwpan/ozeltbuf.c
index 988f522..ac90fc7 100644
--- a/drivers/staging/ozwpan/ozeltbuf.c
+++ b/drivers/staging/ozwpan/ozeltbuf.c
@@ -64,7 +64,7 @@ void oz_elt_buf_term(struct oz_elt_buf *buf)
  */
 struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf)
 {
-	struct oz_elt_info *ei = 0;
+	struct oz_elt_info *ei = NULL;
 	spin_lock_bh(&buf->lock);
 	if (buf->free_elts && buf->elt_pool) {
 		ei = container_of(buf->elt_pool, struct oz_elt_info, link);
@@ -82,9 +82,9 @@ struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf)
 	if (ei) {
 		ei->flags = 0;
 		ei->app_id = 0;
-		ei->callback = 0;
+		ei->callback = NULL;
 		ei->context = 0;
-		ei->stream = 0;
+		ei->stream = NULL;
 		ei->magic = OZ_ELT_INFO_MAGIC_USED;
 		INIT_LIST_HEAD(&ei->link);
 		INIT_LIST_HEAD(&ei->link_order);
@@ -135,7 +135,7 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count)
 	oz_trace("oz_elt_stream_create(0x%x)\n", id);
 
 	st = kzalloc(sizeof(struct oz_elt_stream), GFP_ATOMIC | __GFP_ZERO);
-	if (st == 0)
+	if (st == NULL)
 		return -ENOMEM;
 	atomic_set(&st->ref_count, 1);
 	st->id = id;
@@ -151,7 +151,7 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count)
 int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
 {
 	struct list_head *e;
-	struct oz_elt_stream *st;
+	struct oz_elt_stream *st = NULL;
 	oz_trace("oz_elt_stream_delete(0x%x)\n", id);
 	spin_lock_bh(&buf->lock);
 	e = buf->stream_list.next;
@@ -161,7 +161,7 @@ int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
 			list_del(e);
 			break;
 		}
-		st = 0;
+		st = NULL;
 	}
 	if (!st) {
 		spin_unlock_bh(&buf->lock);
@@ -208,7 +208,7 @@ void oz_elt_stream_put(struct oz_elt_stream *st)
 int oz_queue_elt_info(struct oz_elt_buf *buf, u8 isoc, u8 id,
 	struct oz_elt_info *ei)
 {
-	struct oz_elt_stream *st = 0;
+	struct oz_elt_stream *st = NULL;
 	struct list_head *e;
 	if (id) {
 		list_for_each(e, &buf->stream_list) {
@@ -297,7 +297,7 @@ int oz_select_elts_for_tx(struct oz_elt_buf *buf, u8 isoc, unsigned *len,
 					"Stream down: %d  %d\n",
 					ei->stream->buf_count, ei->length);
 				oz_elt_stream_put(ei->stream);
-				ei->stream = 0;
+				ei->stream = NULL;
 			}
 			INIT_LIST_HEAD(&ei->link_order);
 			list_add_tail(&ei->link, list);
@@ -319,7 +319,7 @@ int oz_are_elts_available(struct oz_elt_buf *buf)
  */
 void oz_trim_elt_pool(struct oz_elt_buf *buf)
 {
-	struct list_head *free = 0;
+	struct list_head *free = NULL;
 	struct list_head *e;
 	spin_lock_bh(&buf->lock);
 	while (buf->free_elts > buf->max_free_elts) {
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 4/7 v2] staging/ozwpan: Fix NULL vs zero in ozproto.c (sparse warning)
  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:22     ` Peter Huewe
  2013-02-15 14:22     ` [PATCH 5/7 v2] staging/ozwpan: Fix NULL vs zero in ozcdev.c " Peter Huewe
                       ` (3 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15 14:22 UTC (permalink / raw)
  To: Rupesh Gujare
  Cc: Greg Kroah-Hartman, devel, linux-kernel, Dan Carpenter, Peter Huewe

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/ozproto.c |   78 +++++++++++++++++++-------------------
 1 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c
index e00a539..40c283c 100644
--- a/drivers/staging/ozwpan/ozproto.c
+++ b/drivers/staging/ozwpan/ozproto.c
@@ -98,7 +98,7 @@ static void oz_send_conn_rsp(struct oz_pd *pd, u8 status)
 	int sz = sizeof(struct oz_hdr) + sizeof(struct oz_elt) +
 			sizeof(struct oz_elt_connect_rsp);
 	skb = alloc_skb(sz + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC);
-	if (skb == 0)
+	if (skb == NULL)
 		return;
 	skb_reserve(skb, LL_RESERVED_SPACE(dev));
 	skb_reset_network_header(skb);
@@ -116,7 +116,7 @@ static void oz_send_conn_rsp(struct oz_pd *pd, u8 status)
 	oz_hdr->control = (OZ_PROTOCOL_VERSION<<OZ_VERSION_SHIFT);
 	oz_hdr->last_pkt_num = 0;
 	put_unaligned(0, &oz_hdr->pkt_num);
-	oz_event_log(OZ_EVT_CONNECT_RSP, 0, 0, 0, 0);
+	oz_event_log(OZ_EVT_CONNECT_RSP, 0, 0, NULL, 0);
 	elt->type = OZ_ELT_CONNECT_RSP;
 	elt->length = sizeof(struct oz_elt_connect_rsp);
 	memset(body, 0, sizeof(struct oz_elt_connect_rsp));
@@ -179,17 +179,17 @@ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt,
 	u8 rsp_status = OZ_STATUS_SUCCESS;
 	u8 stop_needed = 0;
 	u16 new_apps = g_apps;
-	struct net_device *old_net_dev = 0;
-	struct oz_pd *free_pd = 0;
+	struct net_device *old_net_dev = NULL;
+	struct oz_pd *free_pd = NULL;
 	if (cur_pd) {
 		pd = cur_pd;
 		spin_lock_bh(&g_polling_lock);
 	} else {
-		struct oz_pd *pd2 = 0;
+		struct oz_pd *pd2 = NULL;
 		struct list_head *e;
 		pd = oz_pd_alloc(pd_addr);
-		if (pd == 0)
-			return 0;
+		if (pd == NULL)
+			return NULL;
 		pd->last_rx_time_j = jiffies;
 		spin_lock_bh(&g_polling_lock);
 		list_for_each(e, &g_pd_list) {
@@ -203,9 +203,9 @@ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt,
 		if (pd != pd2)
 			list_add_tail(&pd->link, &g_pd_list);
 	}
-	if (pd == 0) {
+	if (pd == NULL) {
 		spin_unlock_bh(&g_polling_lock);
-		return 0;
+		return NULL;
 	}
 	if (pd->net_dev != net_dev) {
 		old_net_dev = pd->net_dev;
@@ -294,7 +294,7 @@ done:
 		if (stop_needed)
 			oz_pd_stop(pd);
 		oz_pd_put(pd);
-		pd = 0;
+		pd = NULL;
 	}
 	if (old_net_dev)
 		dev_put(old_net_dev);
@@ -340,14 +340,14 @@ static void oz_rx_frame(struct sk_buff *skb)
 	u8 *src_addr;
 	struct oz_elt *elt;
 	int length;
-	struct oz_pd *pd = 0;
+	struct oz_pd *pd = NULL;
 	struct oz_hdr *oz_hdr = (struct oz_hdr *)skb_network_header(skb);
 	int dup = 0;
 	u32 pkt_num;
 
 	oz_event_log(OZ_EVT_RX_PROCESS, 0,
 		(((u16)oz_hdr->control)<<8)|oz_hdr->last_pkt_num,
-		0, oz_hdr->pkt_num);
+		NULL, oz_hdr->pkt_num);
 	oz_trace2(OZ_TRACE_RX_FRAMES,
 		"RX frame PN=0x%x LPN=0x%x control=0x%x\n",
 		oz_hdr->pkt_num, oz_hdr->last_pkt_num, oz_hdr->control);
@@ -402,7 +402,7 @@ static void oz_rx_frame(struct sk_buff *skb)
 			break;
 		switch (elt->type) {
 		case OZ_ELT_CONNECT_REQ:
-			oz_event_log(OZ_EVT_CONNECT_REQ, 0, 0, 0, 0);
+			oz_event_log(OZ_EVT_CONNECT_REQ, 0, 0, NULL, 0);
 			oz_trace("RX: OZ_ELT_CONNECT_REQ\n");
 			pd = oz_connect_req(pd, elt, src_addr, skb->dev);
 			break;
@@ -456,7 +456,7 @@ done:
  */
 void oz_protocol_term(void)
 {
-	struct list_head *chain = 0;
+	struct list_head *chain;
 	del_timer_sync(&g_timer);
 	/* Walk the list of bindings and remove each one.
 	 */
@@ -487,7 +487,7 @@ void oz_protocol_term(void)
 		spin_lock_bh(&g_polling_lock);
 	}
 	chain = g_timer_pool;
-	g_timer_pool = 0;
+	g_timer_pool = NULL;
 	spin_unlock_bh(&g_polling_lock);
 	while (chain) {
 		struct oz_timer *t = container_of(chain, struct oz_timer, link);
@@ -534,25 +534,25 @@ static void oz_protocol_timer(unsigned long arg)
 		/* This happens if we remove the current timer but can't stop
 		 * the timer from firing. In this case just get out.
 		 */
-		oz_event_log(OZ_EVT_TIMER, 0, 0, 0, 0);
+		oz_event_log(OZ_EVT_TIMER, 0, 0, NULL, 0);
 		spin_unlock_bh(&g_polling_lock);
 		return;
 	}
 	g_timer_state = OZ_TIMER_IN_HANDLER;
 	t = g_cur_timer;
-	g_cur_timer = 0;
+	g_cur_timer = NULL;
 	list_del(&t->link);
 	spin_unlock_bh(&g_polling_lock);
 	do {
 		pd = t->pd;
-		oz_event_log(OZ_EVT_TIMER, 0, t->type, 0, 0);
+		oz_event_log(OZ_EVT_TIMER, 0, t->type, NULL, 0);
 		oz_pd_handle_timer(pd, t->type);
 		spin_lock_bh(&g_polling_lock);
 		if (g_timer_pool_count < OZ_MAX_TIMER_POOL_SIZE) {
 			t->link.next = g_timer_pool;
 			g_timer_pool = &t->link;
 			g_timer_pool_count++;
-			t = 0;
+			t = NULL;
 		}
 		if (!list_empty(&g_timer_list)) {
 			t2 =  container_of(g_timer_list.next,
@@ -560,9 +560,9 @@ static void oz_protocol_timer(unsigned long arg)
 			if (time_before_eq(t2->due_time, jiffies))
 				list_del(&t2->link);
 			else
-				t2 = 0;
+				t2 = NULL;
 		} else {
-			t2 = 0;
+			t2 = NULL;
 		}
 		spin_unlock_bh(&g_polling_lock);
 		oz_pd_put(pd);
@@ -583,12 +583,12 @@ static void oz_protocol_timer_start(void)
 			container_of(g_timer_list.next, struct oz_timer, link);
 		if (g_timer_state == OZ_TIMER_SET) {
 			oz_event_log(OZ_EVT_TIMER_CTRL, 3,
-				(u16)g_cur_timer->type, 0,
+				(u16)g_cur_timer->type, NULL,
 				(unsigned)g_cur_timer->due_time);
 			mod_timer(&g_timer, g_cur_timer->due_time);
 		} else {
 			oz_event_log(OZ_EVT_TIMER_CTRL, 4,
-				(u16)g_cur_timer->type, 0,
+				(u16)g_cur_timer->type, NULL,
 				(unsigned)g_cur_timer->due_time);
 			g_timer.expires = g_cur_timer->due_time;
 			g_timer.function = oz_protocol_timer;
@@ -608,9 +608,9 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time,
 		int remove)
 {
 	struct list_head *e;
-	struct oz_timer *t = 0;
+	struct oz_timer *t = NULL;
 	int restart_needed = 0;
-	oz_event_log(OZ_EVT_TIMER_CTRL, 1, (u16)type, 0, (unsigned)due_time);
+	oz_event_log(OZ_EVT_TIMER_CTRL, 1, (u16)type, NULL, (unsigned)due_time);
 	spin_lock(&g_polling_lock);
 	if (remove) {
 		list_for_each(e, &g_timer_list) {
@@ -618,12 +618,12 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time,
 			if ((t->pd == pd) && (t->type == type)) {
 				if (g_cur_timer == t) {
 					restart_needed = 1;
-					g_cur_timer = 0;
+					g_cur_timer = NULL;
 				}
 				list_del(e);
 				break;
 			}
-			t = 0;
+			t = NULL;
 		}
 	}
 	if (!t) {
@@ -647,7 +647,7 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time,
 			t2 = container_of(e, struct oz_timer, link);
 			if (time_before(due_time, t2->due_time)) {
 				if (t2 == g_cur_timer) {
-					g_cur_timer = 0;
+					g_cur_timer = NULL;
 					restart_needed = 1;
 				}
 				break;
@@ -668,18 +668,18 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time,
  */
 void oz_timer_delete(struct oz_pd *pd, int type)
 {
-	struct list_head *chain = 0;
+	struct list_head *chain = NULL;
 	struct oz_timer *t;
 	struct oz_timer *n;
 	int restart_needed = 0;
 	int release = 0;
-	oz_event_log(OZ_EVT_TIMER_CTRL, 2, (u16)type, 0, 0);
+	oz_event_log(OZ_EVT_TIMER_CTRL, 2, (u16)type, NULL, 0);
 	spin_lock(&g_polling_lock);
 	list_for_each_entry_safe(t, n, &g_timer_list, link) {
 		if ((t->pd == pd) && ((type == 0) || (t->type == type))) {
 			if (g_cur_timer == t) {
 				restart_needed = 1;
-				g_cur_timer = 0;
+				g_cur_timer = NULL;
 				del_timer(&g_timer);
 			}
 			list_del(&t->link);
@@ -748,7 +748,7 @@ struct oz_pd *oz_pd_find(u8 *mac_addr)
 		}
 	}
 	spin_unlock_bh(&g_polling_lock);
-	return 0;
+	return NULL;
 }
 /*------------------------------------------------------------------------------
  * Context: process
@@ -770,9 +770,9 @@ void oz_app_enable(int app_id, int enable)
 static int oz_pkt_recv(struct sk_buff *skb, struct net_device *dev,
 		struct packet_type *pt, struct net_device *orig_dev)
 {
-	oz_event_log(OZ_EVT_RX_FRAME, 0, 0, 0, 0);
+	oz_event_log(OZ_EVT_RX_FRAME, 0, 0, NULL, 0);
 	skb = skb_share_check(skb, GFP_ATOMIC);
-	if (skb == 0)
+	if (skb == NULL)
 		return 0;
 	spin_lock_bh(&g_rx_queue.lock);
 	if (g_processing_rx) {
@@ -815,14 +815,14 @@ void oz_binding_add(char *net_dev)
 			oz_trace("Adding binding: %s\n", net_dev);
 			binding->ptype.dev =
 				dev_get_by_name(&init_net, net_dev);
-			if (binding->ptype.dev == 0) {
+			if (binding->ptype.dev == NULL) {
 				oz_trace("Netdev %s not found\n", net_dev);
 				kfree(binding);
-				binding = 0;
+				binding = NULL;
 			}
 		} else {
 			oz_trace("Binding to all netcards\n");
-			binding->ptype.dev = 0;
+			binding->ptype.dev = NULL;
 		}
 		if (binding) {
 			dev_add_pack(&binding->ptype);
@@ -876,7 +876,7 @@ static void pd_stop_all_for_device(struct net_device *net_dev)
  */
 void oz_binding_remove(char *net_dev)
 {
-	struct oz_binding *binding = 0;
+	struct oz_binding *binding;
 	struct oz_binding **link;
 	oz_trace("Removing binding: %s\n", net_dev);
 	spin_lock_bh(&g_binding_lock);
@@ -923,7 +923,7 @@ int oz_protocol_init(char *devs)
 {
 	skb_queue_head_init(&g_rx_queue);
 	if (devs && (devs[0] == '*')) {
-		oz_binding_add(0);
+		oz_binding_add(NULL);
 	} else {
 		char d[32];
 		while (*devs) {
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 5/7 v2] staging/ozwpan: Fix NULL vs zero in ozcdev.c (sparse warning)
  2013-02-15 14:22   ` [PATCH 1/7 v2] staging/ozwpan: Fix NULL vs zero in ozpd.c (sparse warning) Peter Huewe
                       ` (2 preceding siblings ...)
  2013-02-15 14:22     ` [PATCH 4/7 v2] staging/ozwpan: Fix NULL vs zero in ozproto.c (sparse warning) Peter Huewe
@ 2013-02-15 14:22     ` Peter Huewe
  2013-02-15 14:22     ` [PATCH 6/7] staging/ozwpan: Fix NULL vs zero in ozusbsvc.c " Peter Huewe
                       ` (2 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15 14:22 UTC (permalink / raw)
  To: Rupesh Gujare
  Cc: Greg Kroah-Hartman, devel, linux-kernel, Dan Carpenter, Peter Huewe

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


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 6/7] staging/ozwpan: Fix NULL vs zero in ozusbsvc.c (sparse warning)
  2013-02-15 14:22   ` [PATCH 1/7 v2] staging/ozwpan: Fix NULL vs zero in ozpd.c (sparse warning) Peter Huewe
                       ` (3 preceding siblings ...)
  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
  2013-02-15 14:22     ` [PATCH 7/7] staging/ozwpan: Fix NULL vs zero in ozhcd.c " Peter Huewe
  2013-02-15 14:55     ` [PATCH 1/7 v2] staging/ozwpan: Fix NULL vs zero in ozpd.c " Dan Carpenter
  6 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15 14:22 UTC (permalink / raw)
  To: Rupesh Gujare
  Cc: Greg Kroah-Hartman, devel, linux-kernel, Dan Carpenter, Peter Huewe

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


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 7/7] staging/ozwpan: Fix NULL vs zero in ozhcd.c (sparse warning)
  2013-02-15 14:22   ` [PATCH 1/7 v2] staging/ozwpan: Fix NULL vs zero in ozpd.c (sparse warning) Peter Huewe
                       ` (4 preceding siblings ...)
  2013-02-15 14:22     ` [PATCH 6/7] staging/ozwpan: Fix NULL vs zero in ozusbsvc.c " Peter Huewe
@ 2013-02-15 14:22     ` 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
  6 siblings, 1 reply; 24+ messages in thread
From: Peter Huewe @ 2013-02-15 14:22 UTC (permalink / raw)
  To: Rupesh Gujare
  Cc: Greg Kroah-Hartman, devel, linux-kernel, Dan Carpenter, Peter Huewe

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/ozhcd.c |  135 ++++++++++++++++++++--------------------
 1 files changed, 68 insertions(+), 67 deletions(-)

diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c
index 9154f33..b48663e 100644
--- a/drivers/staging/ozwpan/ozhcd.c
+++ b/drivers/staging/ozwpan/ozhcd.c
@@ -248,7 +248,7 @@ static int oz_get_port_from_addr(struct oz_hcd *ozhcd, u8 bus_addr)
  */
 static struct oz_urb_link *oz_alloc_urb_link(void)
 {
-	struct oz_urb_link *urbl = 0;
+	struct oz_urb_link *urbl = NULL;
 	unsigned long irq_state;
 	spin_lock_irqsave(&g_link_lock, irq_state);
 	if (g_link_pool) {
@@ -257,7 +257,7 @@ static struct oz_urb_link *oz_alloc_urb_link(void)
 		--g_link_pool_size;
 	}
 	spin_unlock_irqrestore(&g_link_lock, irq_state);
-	if (urbl == 0)
+	if (urbl == NULL)
 		urbl = kmalloc(sizeof(struct oz_urb_link), GFP_ATOMIC);
 	return urbl;
 }
@@ -274,7 +274,7 @@ static void oz_free_urb_link(struct oz_urb_link *urbl)
 		if (g_link_pool_size < OZ_MAX_LINK_POOL_SIZE) {
 			urbl->link.next = g_link_pool;
 			g_link_pool = &urbl->link;
-			urbl = 0;
+			urbl = NULL;
 			g_link_pool_size++;
 		}
 		spin_unlock_irqrestore(&g_link_lock, irq_state);
@@ -291,7 +291,7 @@ static void oz_empty_link_pool(void)
 	unsigned long irq_state;
 	spin_lock_irqsave(&g_link_lock, irq_state);
 	e = g_link_pool;
-	g_link_pool = 0;
+	g_link_pool = NULL;
 	g_link_pool_size = 0;
 	spin_unlock_irqrestore(&g_link_lock, irq_state);
 	while (e) {
@@ -337,7 +337,7 @@ struct oz_urb_link *oz_uncancel_urb(struct oz_hcd *ozhcd, struct urb *urb)
 			return urbl;
 		}
 	}
-	return 0;
+	return NULL;
 }
 /*------------------------------------------------------------------------------
  * This is called when we have finished processing an urb. It unlinks it from
@@ -349,13 +349,13 @@ static void oz_complete_urb(struct usb_hcd *hcd, struct urb *urb,
 {
 	struct oz_hcd *ozhcd = oz_hcd_private(hcd);
 	unsigned long irq_state;
-	struct oz_urb_link *cancel_urbl = 0;
+	struct oz_urb_link *cancel_urbl = NULL;
 	spin_lock_irqsave(&g_tasklet_lock, irq_state);
 	usb_hcd_unlink_urb_from_ep(hcd, urb);
 	/* Clear hcpriv which will prevent it being put in the cancel list
 	 * in the event that an attempt is made to cancel it.
 	 */
-	urb->hcpriv = 0;
+	urb->hcpriv = NULL;
 	/* Walk the cancel list in case the urb is already sitting there.
 	 * Since we process the cancel list in a tasklet rather than in
 	 * the dequeue function this could happen.
@@ -507,7 +507,7 @@ static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
 			ep->last_jiffies = jiffies;
 			ep->credit = 0;
 			oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num,
-					0, 0, ep->credit);
+					0, NULL, ep->credit);
 		}
 	} else {
 		err = -EPIPE;
@@ -525,7 +525,7 @@ static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
 static int oz_dequeue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
 			struct urb *urb)
 {
-	struct oz_urb_link *urbl = 0;
+	struct oz_urb_link *urbl = NULL;
 	struct oz_endpoint *ep;
 	spin_lock_bh(&port->ozhcd->hcd_lock);
 	if (in_dir)
@@ -540,7 +540,7 @@ static int oz_dequeue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
 				list_del_init(e);
 				break;
 			}
-			urbl = 0;
+			urbl = NULL;
 		}
 	}
 	spin_unlock_bh(&port->ozhcd->hcd_lock);
@@ -556,8 +556,8 @@ static struct urb *oz_find_urb_by_id(struct oz_port *port, int ep_ix,
 		u8 req_id)
 {
 	struct oz_hcd *ozhcd = port->ozhcd;
-	struct urb *urb = 0;
-	struct oz_urb_link *urbl = 0;
+	struct urb *urb = NULL;
+	struct oz_urb_link *urbl = NULL;
 	struct oz_endpoint *ep;
 
 	spin_lock_bh(&ozhcd->hcd_lock);
@@ -630,13 +630,13 @@ static inline void oz_hcd_put(struct oz_hcd *ozhcd)
 void *oz_hcd_pd_arrived(void *hpd)
 {
 	int i;
-	void *hport = 0;
-	struct oz_hcd *ozhcd = 0;
+	void *hport = NULL;
+	struct oz_hcd *ozhcd = NULL;
 	struct oz_endpoint *ep;
 	oz_trace("oz_hcd_pd_arrived()\n");
 	ozhcd = oz_hcd_claim();
-	if (ozhcd == 0)
-		return 0;
+	if (ozhcd == NULL)
+		return NULL;
 	/* Allocate an endpoint object in advance (before holding hcd lock) to
 	 * use for out endpoint 0.
 	 */
@@ -663,7 +663,7 @@ void *oz_hcd_pd_arrived(void *hpd)
 		/* Attach out endpoint 0.
 		 */
 		ozhcd->ports[i].out_ep[0] = ep;
-		ep = 0;
+		ep = NULL;
 		hport = &ozhcd->ports[i];
 		spin_unlock_bh(&ozhcd->hcd_lock);
 		if (ozhcd->flags & OZ_HDC_F_SUSPENDED) {
@@ -676,7 +676,7 @@ void *oz_hcd_pd_arrived(void *hpd)
 	}
 out:
 	if (ep) /* ep is non-null if not used. */
-		oz_ep_free(0, ep);
+		oz_ep_free(NULL, ep);
 	oz_hcd_put(ozhcd);
 	return hport;
 }
@@ -691,15 +691,15 @@ void oz_hcd_pd_departed(void *hport)
 	struct oz_port *port = (struct oz_port *)hport;
 	struct oz_hcd *ozhcd;
 	void *hpd;
-	struct oz_endpoint *ep = 0;
+	struct oz_endpoint *ep = NULL;
 
 	oz_trace("oz_hcd_pd_departed()\n");
-	if (port == 0) {
+	if (port == NULL) {
 		oz_trace("oz_hcd_pd_departed() port = 0\n");
 		return;
 	}
 	ozhcd = port->ozhcd;
-	if (ozhcd == 0)
+	if (ozhcd == NULL)
 		return;
 	/* Check if this is the connection port - if so clear it.
 	 */
@@ -717,7 +717,7 @@ void oz_hcd_pd_departed(void *hport)
 	oz_clean_endpoints_for_config(ozhcd->hcd, port);
 	spin_lock_bh(&port->port_lock);
 	hpd = port->hpd;
-	port->hpd = 0;
+	port->hpd = NULL;
 	port->bus_addr = 0xff;
 	port->flags &= ~(OZ_PORT_F_PRESENT | OZ_PORT_F_DYING);
 	port->flags |= OZ_PORT_F_CHANGED;
@@ -728,7 +728,7 @@ void oz_hcd_pd_departed(void *hport)
 	 */
 	if (port->out_ep[0]) {
 		ep = port->out_ep[0];
-		port->out_ep[0] = 0;
+		port->out_ep[0] = NULL;
 	}
 	spin_unlock_bh(&port->port_lock);
 	if (ep)
@@ -764,7 +764,7 @@ void oz_hcd_get_desc_cnf(void *hport, u8 req_id, int status, u8 *desc,
 	struct urb *urb;
 	int err = 0;
 
-	oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, 0, status);
+	oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, NULL, status);
 	oz_trace("oz_hcd_get_desc_cnf length = %d offs = %d tot_size = %d\n",
 			length, offset, total_size);
 	urb = oz_find_urb_by_id(port, 0, req_id);
@@ -903,7 +903,7 @@ void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, u8 *data,
 	unsigned windex;
 	unsigned wvalue;
 
-	oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, 0, rcode);
+	oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, NULL, rcode);
 	oz_trace("oz_hcd_control_cnf rcode=%u len=%d\n", rcode, data_len);
 	urb = oz_find_urb_by_id(port, 0, req_id);
 	if (!urb) {
@@ -988,7 +988,7 @@ void oz_hcd_data_ind(void *hport, u8 endpoint, u8 *data, int data_len)
 	struct oz_hcd *ozhcd = port->ozhcd;
 	spin_lock_bh(&ozhcd->hcd_lock);
 	ep = port->in_ep[endpoint & USB_ENDPOINT_NUMBER_MASK];
-	if (ep == 0)
+	if (ep == NULL)
 		goto done;
 	switch (ep->attrib & USB_ENDPOINT_XFERTYPE_MASK) {
 	case USB_ENDPOINT_XFER_INT:
@@ -1056,7 +1056,8 @@ int oz_hcd_heartbeat(void *hport)
 		ep->credit += jiffies_to_msecs(now - ep->last_jiffies);
 		if (ep->credit > ep->credit_ceiling)
 			ep->credit = ep->credit_ceiling;
-		oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0, ep->credit);
+		oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, NULL,
+			     ep->credit);
 		ep->last_jiffies = now;
 		while (ep->credit && !list_empty(&ep->urb_list)) {
 			urbl = list_first_entry(&ep->urb_list,
@@ -1065,8 +1066,8 @@ int oz_hcd_heartbeat(void *hport)
 			if ((ep->credit + 1) < urb->number_of_packets)
 				break;
 			ep->credit -= urb->number_of_packets;
-			oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0,
-				ep->credit);
+			oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, NULL,
+				     ep->credit);
 			list_move_tail(&urbl->link, &xfr_list);
 		}
 	}
@@ -1096,17 +1097,17 @@ int oz_hcd_heartbeat(void *hport)
 				ep->credit = 0;
 				oz_event_log(OZ_EVT_EP_CREDIT,
 					ep->ep_num | USB_DIR_IN,
-					0, 0, ep->credit);
+					0, NULL, ep->credit);
 				ep->last_jiffies = now;
 				ep->start_frame = 0;
 				oz_event_log(OZ_EVT_EP_BUFFERING,
-					ep->ep_num | USB_DIR_IN, 0, 0, 0);
+					ep->ep_num | USB_DIR_IN, 0, NULL, 0);
 			}
 			continue;
 		}
 		ep->credit += jiffies_to_msecs(now - ep->last_jiffies);
 		oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num | USB_DIR_IN,
-			0, 0, ep->credit);
+			0, NULL, ep->credit);
 		ep->last_jiffies = now;
 		while (!list_empty(&ep->urb_list)) {
 			struct oz_urb_link *urbl =
@@ -1151,7 +1152,7 @@ int oz_hcd_heartbeat(void *hport)
 			list_move_tail(&urbl->link, &xfr_list);
 			ep->credit -= urb->number_of_packets;
 			oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num | USB_DIR_IN,
-				0, 0, ep->credit);
+				0, NULL, ep->credit);
 		}
 	}
 	if (!list_empty(&port->isoc_out_ep) || !list_empty(&port->isoc_in_ep))
@@ -1244,7 +1245,7 @@ static int oz_build_endpoints_for_interface(struct usb_hcd *hcd,
 			if (ep_addr & USB_ENDPOINT_DIR_MASK) {
 				ep->flags |= OZ_F_EP_BUFFERING;
 				oz_event_log(OZ_EVT_EP_BUFFERING,
-					ep->ep_num | USB_DIR_IN, 1, 0, 0);
+					ep->ep_num | USB_DIR_IN, 1, NULL, 0);
 			} else {
 				ep->flags |= OZ_F_EP_HAVE_STREAM;
 				if (oz_usb_stream_create(port->hpd, ep_num))
@@ -1300,7 +1301,7 @@ static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd,
 		 */
 		if ((mask & (1<<i)) && port->out_ep[i]) {
 			e = &port->out_ep[i]->link;
-			port->out_ep[i] = 0;
+			port->out_ep[i] = NULL;
 			/* Remove from isoc list if present.
 			 */
 			list_move_tail(e, &ep_list);
@@ -1309,7 +1310,7 @@ static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd,
 		 */
 		if ((mask & (1<<(i+OZ_NB_ENDPOINTS))) && port->in_ep[i]) {
 			e = &port->in_ep[i]->link;
-			port->in_ep[i] = 0;
+			port->in_ep[i] = NULL;
 			list_move_tail(e, &ep_list);
 		}
 	}
@@ -1370,7 +1371,7 @@ static void oz_clean_endpoints_for_config(struct usb_hcd *hcd,
 	if (port->iface) {
 		oz_trace("Freeing interfaces object.\n");
 		kfree(port->iface);
-		port->iface = 0;
+		port->iface = NULL;
 	}
 	port->num_iface = 0;
 	spin_unlock_bh(&ozhcd->hcd_lock);
@@ -1380,7 +1381,7 @@ static void oz_clean_endpoints_for_config(struct usb_hcd *hcd,
  */
 static void *oz_claim_hpd(struct oz_port *port)
 {
-	void *hpd = 0;
+	void *hpd = NULL;
 	struct oz_hcd *ozhcd = port->ozhcd;
 	spin_lock_bh(&ozhcd->hcd_lock);
 	hpd = port->hpd;
@@ -1399,13 +1400,13 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
 	unsigned windex;
 	unsigned wvalue;
 	unsigned wlength;
-	void *hpd = 0;
+	void *hpd = NULL;
 	u8 req_id;
 	int rc = 0;
 	unsigned complete = 0;
 
 	int port_ix = -1;
-	struct oz_port *port = 0;
+	struct oz_port *port = NULL;
 
 	oz_trace2(OZ_TRACE_URB, "%lu: oz_process_ep0_urb(%p)\n", jiffies, urb);
 	port_ix = oz_get_port_from_addr(ozhcd, urb->dev->devnum);
@@ -1437,7 +1438,7 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
 
 	req_id = port->next_req_id++;
 	hpd = oz_claim_hpd(port);
-	if (hpd == 0) {
+	if (hpd == NULL) {
 		oz_trace("Cannot claim port\n");
 		rc = -EPIPE;
 		goto out;
@@ -1452,7 +1453,7 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
 			break;
 		case USB_REQ_SET_ADDRESS:
 			oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest,
-				0, 0, setup->bRequestType);
+				0, NULL, setup->bRequestType);
 			oz_trace("USB_REQ_SET_ADDRESS - req\n");
 			oz_trace("Port %d address is 0x%x\n", ozhcd->conn_port,
 				(u8)le16_to_cpu(setup->wValue));
@@ -1473,8 +1474,8 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
 			/* We short circuit this case and reply directly since
 			 * we have the selected configuration number cached.
 			 */
-			oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0, 0,
-				setup->bRequestType);
+			oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0,
+				     NULL, setup->bRequestType);
 			oz_trace("USB_REQ_GET_CONFIGURATION - reply now\n");
 			if (urb->transfer_buffer_length >= 1) {
 				urb->actual_length = 1;
@@ -1489,8 +1490,8 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,
 			/* We short circuit this case and reply directly since
 			 * we have the selected interface alternative cached.
 			 */
-			oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0, 0,
-				setup->bRequestType);
+			oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0,
+				     NULL, setup->bRequestType);
 			oz_trace("USB_REQ_GET_INTERFACE - reply now\n");
 			if (urb->transfer_buffer_length >= 1) {
 				urb->actual_length = 1;
@@ -1583,7 +1584,7 @@ static void oz_urb_process_tasklet(unsigned long unused)
 	struct urb *urb;
 	struct oz_hcd *ozhcd = oz_hcd_claim();
 	int rc = 0;
-	if (ozhcd == 0)
+	if (ozhcd == NULL)
 		return;
 	/* This is called from a tasklet so is in softirq context but the urb
 	 * list is filled from any context so we need to lock
@@ -1617,17 +1618,17 @@ static void oz_urb_process_tasklet(unsigned long unused)
  */
 static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
 {
-	struct oz_urb_link *urbl = 0;
+	struct oz_urb_link *urbl = NULL;
 	struct list_head *e;
 	struct oz_hcd *ozhcd;
 	unsigned long irq_state;
 	u8 ix;
-	if (port == 0) {
+	if (port == NULL) {
 		oz_trace("ERRORERROR: oz_urb_cancel(%p) port is null\n", urb);
 		return;
 	}
 	ozhcd = port->ozhcd;
-	if (ozhcd == 0) {
+	if (ozhcd == NULL) {
 		oz_trace("ERRORERROR: oz_urb_cancel(%p) ozhcd is null\n", urb);
 		return;
 	}
@@ -1644,7 +1645,7 @@ static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
 		}
 	}
 	spin_unlock_irqrestore(&g_tasklet_lock, irq_state);
-	urbl = 0;
+	urbl = NULL;
 
 	/* Look in the orphanage.
 	 */
@@ -1658,7 +1659,7 @@ static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
 		}
 	}
 	ix = (ep_num & 0xf);
-	urbl = 0;
+	urbl = NULL;
 	if ((ep_num & USB_DIR_IN) && ix)
 		urbl = oz_remove_urb(port->in_ep[ix], urb);
 	else
@@ -1680,7 +1681,7 @@ static void oz_urb_cancel_tasklet(unsigned long unused)
 	unsigned long irq_state;
 	struct urb *urb;
 	struct oz_hcd *ozhcd = oz_hcd_claim();
-	if (ozhcd == 0)
+	if (ozhcd == NULL)
 		return;
 	spin_lock_irqsave(&g_tasklet_lock, irq_state);
 	while (!list_empty(&ozhcd->urb_cancel_list)) {
@@ -1772,7 +1773,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
 		jiffies, urb);
 	oz_event_log(OZ_EVT_URB_SUBMIT, oz_get_irq_ctx(),
 		(u16)urb->number_of_packets, urb, urb->pipe);
-	if (unlikely(ozhcd == 0)) {
+	if (unlikely(ozhcd == NULL)) {
 		oz_trace2(OZ_TRACE_URB, "%lu: Refused urb(%p) not ozhcd.\n",
 			jiffies, urb);
 		return -EPIPE;
@@ -1786,7 +1787,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
 	if (port_ix < 0)
 		return -EPIPE;
 	port =  &ozhcd->ports[port_ix];
-	if (port == 0)
+	if (port == NULL)
 		return -EPIPE;
 	if ((port->flags & OZ_PORT_F_PRESENT) == 0) {
 		oz_trace("Refusing URB port_ix = %d devnum = %d\n",
@@ -1797,7 +1798,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
 	/* Put request in queue for processing by tasklet.
 	 */
 	urbl = oz_alloc_urb_link();
-	if (unlikely(urbl == 0))
+	if (unlikely(urbl == NULL))
 		return -ENOMEM;
 	urbl->urb = urb;
 	spin_lock_irqsave(&g_tasklet_lock, irq_state);
@@ -1819,10 +1820,10 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
 static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep,
 				struct urb *urb)
 {
-	struct oz_urb_link *urbl = 0;
+	struct oz_urb_link *urbl = NULL;
 	struct list_head *e;
-	if (unlikely(ep == 0))
-		return 0;
+	if (unlikely(ep == NULL))
+		return NULL;
 	list_for_each(e, &ep->urb_list) {
 		urbl = container_of(e, struct oz_urb_link, link);
 		if (urbl->urb == urb) {
@@ -1834,12 +1835,12 @@ static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep,
 				oz_event_log(OZ_EVT_EP_CREDIT,
 					usb_pipein(urb->pipe) ?
 					(ep->ep_num | USB_DIR_IN) : ep->ep_num,
-					0, 0, ep->credit);
+					0, NULL, ep->credit);
 			}
 			return urbl;
 		}
 	}
-	return 0;
+	return NULL;
 }
 /*------------------------------------------------------------------------------
  * Called to dequeue a previously submitted urb for the device.
@@ -1848,12 +1849,12 @@ static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep,
 static int oz_hcd_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
 {
 	struct oz_hcd *ozhcd = oz_hcd_private(hcd);
-	struct oz_urb_link *urbl = 0;
+	struct oz_urb_link *urbl = NULL;
 	int rc;
 	unsigned long irq_state;
 	oz_trace2(OZ_TRACE_URB, "%lu: oz_hcd_urb_dequeue(%p)\n", jiffies, urb);
 	urbl = oz_alloc_urb_link();
-	if (unlikely(urbl == 0))
+	if (unlikely(urbl == NULL))
 		return -ENOMEM;
 	spin_lock_irqsave(&g_tasklet_lock, irq_state);
 	/* The following function checks the urb is still in the queue
@@ -2193,7 +2194,7 @@ static int oz_plat_probe(struct platform_device *dev)
 	struct oz_hcd *ozhcd;
 	oz_trace("oz_plat_probe()\n");
 	hcd = usb_create_hcd(&g_oz_hc_drv, &dev->dev, dev_name(&dev->dev));
-	if (hcd == 0) {
+	if (hcd == NULL) {
 		oz_trace("Failed to created hcd object OK\n");
 		return -ENOMEM;
 	}
@@ -2232,12 +2233,12 @@ static int oz_plat_remove(struct platform_device *dev)
 	struct usb_hcd *hcd = platform_get_drvdata(dev);
 	struct oz_hcd *ozhcd;
 	oz_trace("oz_plat_remove()\n");
-	if (hcd == 0)
+	if (hcd == NULL)
 		return -1;
 	ozhcd = oz_hcd_private(hcd);
 	spin_lock_bh(&g_hcdlock);
 	if (ozhcd == g_ozhcd)
-		g_ozhcd = 0;
+		g_ozhcd = NULL;
 	spin_unlock_bh(&g_hcdlock);
 	oz_trace("Clearing orphanage\n");
 	oz_hcd_clear_orphanage(ozhcd, -EPIPE);
@@ -2278,7 +2279,7 @@ int oz_hcd_init(void)
 	if (err)
 		goto error;
 	g_plat_dev = platform_device_alloc(OZ_PLAT_DEV_NAME, -1);
-	if (g_plat_dev == 0) {
+	if (g_plat_dev == NULL) {
 		err = -ENOMEM;
 		goto error1;
 	}
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning)
  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 Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning Peter Huewe
  0 siblings, 1 reply; 24+ messages in thread
From: Dan Carpenter @ 2013-02-15 14:52 UTC (permalink / raw)
  To: Peter Huewe; +Cc: Rupesh Gujare, Greg Kroah-Hartman, devel, linux-kernel

On Fri, Feb 15, 2013 at 03:22:24PM +0100, Peter Huewe wrote:
> 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>
> ---
> @@ -151,7 +151,7 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count)
>  int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
>  {
>  	struct list_head *e;
> -	struct oz_elt_stream *st;
> +	struct oz_elt_stream *st = NULL;
>  	oz_trace("oz_elt_stream_delete(0x%x)\n", id);
>  	spin_lock_bh(&buf->lock);
>  	e = buf->stream_list.next;

You changed the code here.  The original code would crash if
buf->stream_list was empty.  I don't if that can happen, but I still
consider it a bug fix.

Good job, but next time you mention it in the changelog.

You've fixed a couple of these uninitialized variable bugs recently.
Is this is a clang warning?  GCC doesn't catch it.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 1/7 v2] staging/ozwpan: Fix NULL vs zero in ozpd.c (sparse warning)
  2013-02-15 14:22   ` [PATCH 1/7 v2] staging/ozwpan: Fix NULL vs zero in ozpd.c (sparse warning) Peter Huewe
                       ` (5 preceding siblings ...)
  2013-02-15 14:22     ` [PATCH 7/7] staging/ozwpan: Fix NULL vs zero in ozhcd.c " Peter Huewe
@ 2013-02-15 14:55     ` Dan Carpenter
  6 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2013-02-15 14:55 UTC (permalink / raw)
  To: Peter Huewe; +Cc: Rupesh Gujare, Greg Kroah-Hartman, devel, linux-kernel

Looks great.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning)
  2013-02-15 14:52       ` Dan Carpenter
@ 2013-02-15 15:57           ` Peter Huewe
  0 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15 15:57 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Rupesh Gujare, Greg Kroah-Hartman, devel, linux-kernel, Kernel Janitors

[-- Attachment #1: Type: Text/Plain, Size: 4487 bytes --]

Am Freitag, 15. Februar 2013, 15:52:26 schrieb Dan Carpenter:
> > @@ -151,7 +151,7 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8
> > id, int max_buf_count)
> > 
> >  int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
> >  {
> >  
> >  	struct list_head *e;
> > 
> > -	struct oz_elt_stream *st;
> > +	struct oz_elt_stream *st = NULL;
> > 
> >  	oz_trace("oz_elt_stream_delete(0x%x)\n", id);
> >  	spin_lock_bh(&buf->lock);
> >  	e = buf->stream_list.next;
> 
> You changed the code here.  The original code would crash if
> buf->stream_list was empty.  I don't if that can happen, but I still
> consider it a bug fix.

Yeah - you're right. It's a bug fix and I should have mentioned it.

> You've fixed a couple of these uninitialized variable bugs recently.
> Is this is a clang warning?  GCC doesn't catch it.

(Added janitors on CC as it might be interesting for people over there as 
well).

Exactly, 
Clang reports it as "Branch condition evaluates to a garbage value"

I usually do sparse, smatch and coccicheck, but
lately I've been doing some research on using clang as a static code analyzer, 
especially with the _awesome_ scan-build tool / scan-view frontend.
It works great most of the time, but it requires quite some time to evaluate 
the results and sort out the false positives (which are quite high in number). 

With scan build you can simply type  something like

 scan-build --keep-going -o /tmp make CC="ccc-analyzer -isystem /data/linux-
staging/include/linux/" -C /data/linux-staging/ M=`pwd` -j15 

And then get the results in a nice web browser interface with scan-view.
scan-view is a simple local webserver display the results, also let's you open 
the files directly and send out bug reports but is not really necessary, you 
can also open the html files directly. (without the the bug report and file open 
capabilty)

The syntax for scan-build is more or less
scan-build make CC="ccc-analyzer" MAKE_OPTIONS
where MAKE_OPTIONS is simply the rest of your make commandline, so it can be 
almost anything.

I usually add --keep-going to scan-build so that I get some report if 
something fails and also add
-isystem to ccc-analyzer (which is clang) to (try to) silence some warnings in 
system headers.

I did attach the output of some intermediate result, which you can simply open 
in your webbrowser.
If you open report-tNqJkl.html in your browser (or rather 2013-02-15-1/report-
tNqJkl.html#EndPath) you see the exact flow how this bug could be triggered.

For those who don't want to open the attachment it looks something like this:


151	int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
152	{
153		struct list_head *e;
154		struct oz_elt_stream *st;
155		oz_trace("oz_elt_stream_delete(0x%x)\n", id);
156		spin_lock_bh(&buf->lock);
	
->C1	Calling 'spin_lock_bh'	
->C2	Returning from 'spin_lock_bh'	

157		e = buf->stream_list.next;
158		while (e != &buf->stream_list) {
	
->C3	Loop condition is false. Execution continues on line 166	

159			st = container_of(e, struct oz_elt_stream, link);
160			if (st->id == id) {
161				list_del(e);
162				break;
163			}
164			st = NULL;
165		}
166		if (!st) {
	
->C4	Branch condition evaluates to a garbage value

167			spin_unlock_bh(&buf->lock);
168			return -1;
169		}


I marked the clang annotations with ->C prefix.

Of course the web interface is MUCH better.



The only real issue _I_ currently have with clang is that is has some problems 
with some inline assembler code which he always fails to compile. 
For static analysis purposes I simply have 5 patches with comment these 
passages out.
As far as I've heard it works out of the box for most people even without 
these patches - maybe I compiled clang/llvm incorrectly.

And of course the high number false positives and stuff I simply don't 
understand ;) (e.g. "bugs" with a path length of over 128 ;)

In the llvm _source_ package the tools are located under:
llvm/tools/clang/tools/scan-build/
llvm/tools/clang/tools/scan-view/
not in the llvm-build directory!
 (yes this is a bit strange)



If anyone want's something 'analyzed' with clang by me, simply drop me a mail 
and I can let it run on whatever code you want.
If there is interest I could send out the clang report for the whole staging 
subsystem ;) which I suprisingly have laying around ;)

If a more detailed write up on howto setup clang and how to use it as a static 
code analyzer for the kernel I could proably write something about it.


Thanks,
PeterH



[-- Attachment #2: clang-results.tar.bz2 --]
[-- Type: application/x-bzip-compressed-tar, Size: 52460 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning
@ 2013-02-15 15:57           ` Peter Huewe
  0 siblings, 0 replies; 24+ messages in thread
From: Peter Huewe @ 2013-02-15 15:57 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Rupesh Gujare, Greg Kroah-Hartman, devel, linux-kernel, Kernel Janitors

[-- Attachment #1: Type: Text/Plain, Size: 4487 bytes --]

Am Freitag, 15. Februar 2013, 15:52:26 schrieb Dan Carpenter:
> > @@ -151,7 +151,7 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8
> > id, int max_buf_count)
> > 
> >  int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
> >  {
> >  
> >  	struct list_head *e;
> > 
> > -	struct oz_elt_stream *st;
> > +	struct oz_elt_stream *st = NULL;
> > 
> >  	oz_trace("oz_elt_stream_delete(0x%x)\n", id);
> >  	spin_lock_bh(&buf->lock);
> >  	e = buf->stream_list.next;
> 
> You changed the code here.  The original code would crash if
> buf->stream_list was empty.  I don't if that can happen, but I still
> consider it a bug fix.

Yeah - you're right. It's a bug fix and I should have mentioned it.

> You've fixed a couple of these uninitialized variable bugs recently.
> Is this is a clang warning?  GCC doesn't catch it.

(Added janitors on CC as it might be interesting for people over there as 
well).

Exactly, 
Clang reports it as "Branch condition evaluates to a garbage value"

I usually do sparse, smatch and coccicheck, but
lately I've been doing some research on using clang as a static code analyzer, 
especially with the _awesome_ scan-build tool / scan-view frontend.
It works great most of the time, but it requires quite some time to evaluate 
the results and sort out the false positives (which are quite high in number). 

With scan build you can simply type  something like

 scan-build --keep-going -o /tmp make CC="ccc-analyzer -isystem /data/linux-
staging/include/linux/" -C /data/linux-staging/ M=`pwd` -j15 

And then get the results in a nice web browser interface with scan-view.
scan-view is a simple local webserver display the results, also let's you open 
the files directly and send out bug reports but is not really necessary, you 
can also open the html files directly. (without the the bug report and file open 
capabilty)

The syntax for scan-build is more or less
scan-build make CC="ccc-analyzer" MAKE_OPTIONS
where MAKE_OPTIONS is simply the rest of your make commandline, so it can be 
almost anything.

I usually add --keep-going to scan-build so that I get some report if 
something fails and also add
-isystem to ccc-analyzer (which is clang) to (try to) silence some warnings in 
system headers.

I did attach the output of some intermediate result, which you can simply open 
in your webbrowser.
If you open report-tNqJkl.html in your browser (or rather 2013-02-15-1/report-
tNqJkl.html#EndPath) you see the exact flow how this bug could be triggered.

For those who don't want to open the attachment it looks something like this:


151	int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
152	{
153		struct list_head *e;
154		struct oz_elt_stream *st;
155		oz_trace("oz_elt_stream_delete(0x%x)\n", id);
156		spin_lock_bh(&buf->lock);
	
->C1	Calling 'spin_lock_bh'	
->C2	Returning from 'spin_lock_bh'	

157		e = buf->stream_list.next;
158		while (e != &buf->stream_list) {
	
->C3	Loop condition is false. Execution continues on line 166	

159			st = container_of(e, struct oz_elt_stream, link);
160			if (st->id == id) {
161				list_del(e);
162				break;
163			}
164			st = NULL;
165		}
166		if (!st) {
	
->C4	Branch condition evaluates to a garbage value

167			spin_unlock_bh(&buf->lock);
168			return -1;
169		}


I marked the clang annotations with ->C prefix.

Of course the web interface is MUCH better.



The only real issue _I_ currently have with clang is that is has some problems 
with some inline assembler code which he always fails to compile. 
For static analysis purposes I simply have 5 patches with comment these 
passages out.
As far as I've heard it works out of the box for most people even without 
these patches - maybe I compiled clang/llvm incorrectly.

And of course the high number false positives and stuff I simply don't 
understand ;) (e.g. "bugs" with a path length of over 128 ;)

In the llvm _source_ package the tools are located under:
llvm/tools/clang/tools/scan-build/
llvm/tools/clang/tools/scan-view/
not in the llvm-build directory!
 (yes this is a bit strange)



If anyone want's something 'analyzed' with clang by me, simply drop me a mail 
and I can let it run on whatever code you want.
If there is interest I could send out the clang report for the whole staging 
subsystem ;) which I suprisingly have laying around ;)

If a more detailed write up on howto setup clang and how to use it as a static 
code analyzer for the kernel I could proably write something about it.


Thanks,
PeterH



[-- Attachment #2: clang-results.tar.bz2 --]
[-- Type: application/x-bzip-compressed-tar, Size: 52460 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning)
  2013-02-15 15:57           ` Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning Peter Huewe
@ 2013-02-15 16:11             ` Dan Carpenter
  -1 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2013-02-15 16:11 UTC (permalink / raw)
  To: Peter Huewe
  Cc: Rupesh Gujare, Greg Kroah-Hartman, devel, linux-kernel, Kernel Janitors

Are you using this version of clang?:

http://git.linuxfoundation.org/llvmlinux.git/

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse war
@ 2013-02-15 16:11             ` Dan Carpenter
  0 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2013-02-15 16:11 UTC (permalink / raw)
  To: Peter Huewe
  Cc: Rupesh Gujare, Greg Kroah-Hartman, devel, linux-kernel, Kernel Janitors

Are you using this version of clang?:

http://git.linuxfoundation.org/llvmlinux.git/

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning)
  2013-02-15 16:11             ` Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse war Dan Carpenter
@ 2013-02-15 16:34               ` Peter Hüwe
  -1 siblings, 0 replies; 24+ messages in thread
From: Peter Hüwe @ 2013-02-15 16:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Rupesh Gujare, Greg Kroah-Hartman, devel, linux-kernel, Kernel Janitors

Am Freitag, 15. Februar 2013, 17:11:02 schrieb Dan Carpenter:
> Are you using this version of clang?:
> 
> http://git.linuxfoundation.org/llvmlinux.git/
> 
> regards,
> dan carpenter

Hi,

nope - plain vanilla llvm/clang, but I use some of the kernel patches from 
there:
http://git.linuxfoundation.org/?p=llvmlinux.git;a=tree;f=arch/x86_64/patches;hb=master

The main reason for not using llvmlinux is that it builds a lot more than I 
need (e.g. buildbot/qemu) but maybe I should give it a try some time.


Peter

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse war
@ 2013-02-15 16:34               ` Peter Hüwe
  0 siblings, 0 replies; 24+ messages in thread
From: Peter Hüwe @ 2013-02-15 16:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Rupesh Gujare, Greg Kroah-Hartman, devel, linux-kernel, Kernel Janitors

Am Freitag, 15. Februar 2013, 17:11:02 schrieb Dan Carpenter:
> Are you using this version of clang?:
> 
> http://git.linuxfoundation.org/llvmlinux.git/
> 
> regards,
> dan carpenter

Hi,

nope - plain vanilla llvm/clang, but I use some of the kernel patches from 
there:
http://git.linuxfoundation.org/?p=llvmlinux.git;a=tree;f=arch/x86_64/patches;hb=master

The main reason for not using llvmlinux is that it builds a lot more than I 
need (e.g. buildbot/qemu) but maybe I should give it a try some time.


Peter

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 7/7] staging/ozwpan: Fix NULL vs zero in ozhcd.c (sparse warning)
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Rupesh Gujare @ 2013-02-15 18:56 UTC (permalink / raw)
  To: Peter Huewe; +Cc: Greg Kroah-Hartman, devel, linux-kernel, Dan Carpenter

Thanks Peter, Looks good to me.

Acked-by: Rupesh Gujare <rupesh.gujare@atmel.com>

-- 
Regards,
Rupesh Gujare


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2013-02-15 18:56 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 15:57           ` Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning Peter Huewe
2013-02-15 16:11           ` Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning) Dan Carpenter
2013-02-15 16:11             ` Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse war Dan Carpenter
2013-02-15 16:34             ` Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning) Peter Hüwe
2013-02-15 16:34               ` Clang Analyzer was Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse war Peter Hüwe
2013-02-15 14:22     ` [PATCH 4/7 v2] staging/ozwpan: Fix NULL vs zero in ozproto.c (sparse warning) 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     ` [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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.