All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] drivers/net: Remove unnecessary [kv][mcz]alloc casts
@ 2010-11-28  9:05 Joe Perches
  2010-11-28  9:05 ` [PATCH 1/4] netxen: remove " Joe Perches
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Joe Perches @ 2010-11-28  9:05 UTC (permalink / raw)
  To: netdev, linux-wireless; +Cc: linux-kernel

These are the last remaining alloc casts in drivers/net...

Joe Perches (4):
  netxen: remove unnecessary [kv][mcz]alloc casts
  qlcnic: remove unnecessary [kv][mcz]alloc casts
  vxge: remove unnecessary [kv][mcz]alloc casts
  zd1211rw: remove unnecessary [kv][mcz]alloc casts

 drivers/net/netxen/netxen_nic_init.c    |    3 +--
 drivers/net/qlcnic/qlcnic_init.c        |    3 +--
 drivers/net/vxge/vxge-config.c          |   24 +++++++++---------------
 drivers/net/vxge/vxge-main.c            |    4 +---
 drivers/net/wireless/zd1211rw/zd_chip.c |    3 +--
 5 files changed, 13 insertions(+), 24 deletions(-)

-- 
1.7.3.2.245.g03276.dirty


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

* [PATCH 1/4] netxen: remove unnecessary [kv][mcz]alloc casts
  2010-11-28  9:05 [PATCH 0/4] drivers/net: Remove unnecessary [kv][mcz]alloc casts Joe Perches
@ 2010-11-28  9:05 ` Joe Perches
  2010-11-28  9:05 ` [PATCH 2/4] qlcnic: " Joe Perches
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2010-11-28  9:05 UTC (permalink / raw)
  To: Amit Kumar Salecha; +Cc: netdev, linux-kernel

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/netxen/netxen_nic_init.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index f946de2..731077d 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -278,8 +278,7 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
 			break;
 
 		}
-		rds_ring->rx_buf_arr = (struct netxen_rx_buffer *)
-			vzalloc(RCV_BUFF_RINGSIZE(rds_ring));
+		rds_ring->rx_buf_arr = vzalloc(RCV_BUFF_RINGSIZE(rds_ring));
 		if (rds_ring->rx_buf_arr == NULL) {
 			printk(KERN_ERR "%s: Failed to allocate "
 				"rx buffer ring %d\n",
-- 
1.7.3.2.245.g03276.dirty


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

* [PATCH 2/4] qlcnic: remove unnecessary [kv][mcz]alloc casts
  2010-11-28  9:05 [PATCH 0/4] drivers/net: Remove unnecessary [kv][mcz]alloc casts Joe Perches
  2010-11-28  9:05 ` [PATCH 1/4] netxen: remove " Joe Perches
@ 2010-11-28  9:05 ` Joe Perches
  2010-11-28  9:05 ` [PATCH 3/4] vxge: " Joe Perches
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2010-11-28  9:05 UTC (permalink / raw)
  To: Amit Kumar Salecha, Anirban Chakraborty, linux-driver
  Cc: netdev, linux-kernel

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/qlcnic/qlcnic_init.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 3f97018..c5ea2f4 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -274,8 +274,7 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter)
 				rds_ring->dma_size + NET_IP_ALIGN;
 			break;
 		}
-		rds_ring->rx_buf_arr = (struct qlcnic_rx_buffer *)
-			vzalloc(RCV_BUFF_RINGSIZE(rds_ring));
+		rds_ring->rx_buf_arr = vzalloc(RCV_BUFF_RINGSIZE(rds_ring));
 		if (rds_ring->rx_buf_arr == NULL) {
 			dev_err(&netdev->dev, "Failed to allocate "
 				"rx buffer ring %d\n", ring);
-- 
1.7.3.2.245.g03276.dirty


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

* [PATCH 3/4] vxge: remove unnecessary [kv][mcz]alloc casts
  2010-11-28  9:05 [PATCH 0/4] drivers/net: Remove unnecessary [kv][mcz]alloc casts Joe Perches
  2010-11-28  9:05 ` [PATCH 1/4] netxen: remove " Joe Perches
  2010-11-28  9:05 ` [PATCH 2/4] qlcnic: " Joe Perches
@ 2010-11-28  9:05 ` Joe Perches
  2010-11-28  9:05   ` Joe Perches
  2010-11-29  1:26 ` [PATCH 0/4] drivers/net: Remove unnecessary [kv][mcz]alloc casts David Miller
  4 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2010-11-28  9:05 UTC (permalink / raw)
  To: Ramkrishna Vepa, Sivakumar Subramani, Sreenivasa Honnur,
	Jon Mason
  Cc: netdev, linux-kernel

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/vxge/vxge-config.c |   24 +++++++++---------------
 drivers/net/vxge/vxge-main.c   |    4 +---
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c
index 44d3ddd..a0241fe 100644
--- a/drivers/net/vxge/vxge-config.c
+++ b/drivers/net/vxge/vxge-config.c
@@ -1219,8 +1219,7 @@ vxge_hw_device_initialize(
 	if (status != VXGE_HW_OK)
 		goto exit;
 
-	hldev = (struct __vxge_hw_device *)
-			vzalloc(sizeof(struct __vxge_hw_device));
+	hldev = vzalloc(sizeof(struct __vxge_hw_device));
 	if (hldev == NULL) {
 		status = VXGE_HW_ERR_OUT_OF_MEMORY;
 		goto exit;
@@ -2140,8 +2139,7 @@ __vxge_hw_mempool_create(
 		goto exit;
 	}
 
-	mempool = (struct vxge_hw_mempool *)
-			vzalloc(sizeof(struct vxge_hw_mempool));
+	mempool = vzalloc(sizeof(struct vxge_hw_mempool));
 	if (mempool == NULL) {
 		status = VXGE_HW_ERR_OUT_OF_MEMORY;
 		goto exit;
@@ -2165,7 +2163,7 @@ __vxge_hw_mempool_create(
 
 	/* allocate array of memblocks */
 	mempool->memblocks_arr =
-		(void **) vzalloc(sizeof(void *) * mempool->memblocks_max);
+		vzalloc(sizeof(void *) * mempool->memblocks_max);
 	if (mempool->memblocks_arr == NULL) {
 		__vxge_hw_mempool_destroy(mempool);
 		status = VXGE_HW_ERR_OUT_OF_MEMORY;
@@ -2175,7 +2173,7 @@ __vxge_hw_mempool_create(
 
 	/* allocate array of private parts of items per memblocks */
 	mempool->memblocks_priv_arr =
-		(void **) vzalloc(sizeof(void *) * mempool->memblocks_max);
+		vzalloc(sizeof(void *) * mempool->memblocks_max);
 	if (mempool->memblocks_priv_arr == NULL) {
 		__vxge_hw_mempool_destroy(mempool);
 		status = VXGE_HW_ERR_OUT_OF_MEMORY;
@@ -2184,7 +2182,7 @@ __vxge_hw_mempool_create(
 	}
 
 	/* allocate array of memblocks DMA objects */
-	mempool->memblocks_dma_arr = (struct vxge_hw_mempool_dma *)
+	mempool->memblocks_dma_arr =
 		vzalloc(sizeof(struct vxge_hw_mempool_dma) *
 			mempool->memblocks_max);
 
@@ -2196,8 +2194,7 @@ __vxge_hw_mempool_create(
 	}
 
 	/* allocate hash array of items */
-	mempool->items_arr =
-		(void **) vzalloc(sizeof(void *) * mempool->items_max);
+	mempool->items_arr = vzalloc(sizeof(void *) * mempool->items_max);
 	if (mempool->items_arr == NULL) {
 		__vxge_hw_mempool_destroy(mempool);
 		status = VXGE_HW_ERR_OUT_OF_MEMORY;
@@ -4258,8 +4255,7 @@ vxge_hw_vpath_open(struct __vxge_hw_device *hldev,
 	if (status != VXGE_HW_OK)
 		goto vpath_open_exit1;
 
-	vp = (struct __vxge_hw_vpath_handle *)
-		vzalloc(sizeof(struct __vxge_hw_vpath_handle));
+	vp = vzalloc(sizeof(struct __vxge_hw_vpath_handle));
 	if (vp == NULL) {
 		status = VXGE_HW_ERR_OUT_OF_MEMORY;
 		goto vpath_open_exit2;
@@ -5065,8 +5061,7 @@ static void vxge_hw_blockpool_block_add(struct __vxge_hw_device *devh,
 				item);
 
 	if (entry == NULL)
-		entry = (struct __vxge_hw_blockpool_entry *)
-			vmalloc(sizeof(struct __vxge_hw_blockpool_entry));
+		entry = vmalloc(sizeof(struct __vxge_hw_blockpool_entry));
 	else
 		list_del(&entry->item);
 
@@ -5182,8 +5177,7 @@ __vxge_hw_blockpool_free(struct __vxge_hw_device *devh,
 					item);
 
 		if (entry == NULL)
-			entry = (struct __vxge_hw_blockpool_entry *)
-				vmalloc(sizeof(
+			entry = vmalloc(sizeof(
 					struct __vxge_hw_blockpool_entry));
 		else
 			list_del(&entry->item);
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index 5cba4a6..a21dae1 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -4602,9 +4602,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
 
 	/* Copy the station mac address to the list */
 	for (i = 0; i < vdev->no_of_vpath; i++) {
-		entry =	(struct vxge_mac_addrs *)
-				kzalloc(sizeof(struct vxge_mac_addrs),
-					GFP_KERNEL);
+		entry =	kzalloc(sizeof(struct vxge_mac_addrs), GFP_KERNEL);
 		if (NULL == entry) {
 			vxge_debug_init(VXGE_ERR,
 				"%s: mac_addr_list : memory allocation failed",
-- 
1.7.3.2.245.g03276.dirty


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

* [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
@ 2010-11-28  9:05   ` Joe Perches
  0 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2010-11-28  9:05 UTC (permalink / raw)
  To: Daniel Drake, Ulrich Kunitz
  Cc: John W. Linville, linux-wireless, netdev, linux-kernel

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/wireless/zd1211rw/zd_chip.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 87a95bc..dfcebed 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -117,8 +117,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
 
 	/* Allocate a single memory block for values and addresses. */
 	count16 = 2*count;
-	a16 = (zd_addr_t *) kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)),
-		                   GFP_KERNEL);
+	a16 = kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)), GFP_KERNEL);
 	if (!a16) {
 		dev_dbg_f(zd_chip_dev(chip),
 			  "error ENOMEM in allocation of a16\n");
-- 
1.7.3.2.245.g03276.dirty


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

* [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
@ 2010-11-28  9:05   ` Joe Perches
  0 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2010-11-28  9:05 UTC (permalink / raw)
  To: Daniel Drake, Ulrich Kunitz
  Cc: John W. Linville, linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
---
 drivers/net/wireless/zd1211rw/zd_chip.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 87a95bc..dfcebed 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -117,8 +117,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
 
 	/* Allocate a single memory block for values and addresses. */
 	count16 = 2*count;
-	a16 = (zd_addr_t *) kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)),
-		                   GFP_KERNEL);
+	a16 = kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)), GFP_KERNEL);
 	if (!a16) {
 		dev_dbg_f(zd_chip_dev(chip),
 			  "error ENOMEM in allocation of a16\n");
-- 
1.7.3.2.245.g03276.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
  2010-11-28  9:05   ` Joe Perches
  (?)
@ 2010-11-28  9:12   ` Johannes Berg
  2010-11-28  9:20     ` Joe Perches
  -1 siblings, 1 reply; 16+ messages in thread
From: Johannes Berg @ 2010-11-28  9:12 UTC (permalink / raw)
  To: Joe Perches
  Cc: Daniel Drake, Ulrich Kunitz, John W. Linville, linux-wireless,
	netdev, linux-kernel

On Sun, 2010-11-28 at 01:05 -0800, Joe Perches wrote:
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/net/wireless/zd1211rw/zd_chip.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
> index 87a95bc..dfcebed 100644
> --- a/drivers/net/wireless/zd1211rw/zd_chip.c
> +++ b/drivers/net/wireless/zd1211rw/zd_chip.c
> @@ -117,8 +117,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
>  
>  	/* Allocate a single memory block for values and addresses. */
>  	count16 = 2*count;
> -	a16 = (zd_addr_t *) kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)),
> -		                   GFP_KERNEL);
> +	a16 = kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)), GFP_KERNEL);

I believe this is on purpose for sparse.

johannes


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

* Re: [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
  2010-11-28  9:12   ` Johannes Berg
@ 2010-11-28  9:20     ` Joe Perches
  2010-11-28  9:30       ` Johannes Berg
  0 siblings, 1 reply; 16+ messages in thread
From: Joe Perches @ 2010-11-28  9:20 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Daniel Drake, Ulrich Kunitz, linux-wireless, John W. Linville,
	linux-kernel, netdev

On Sun, 2010-11-28 at 10:12 +0100, Johannes Berg wrote:
> On Sun, 2010-11-28 at 01:05 -0800, Joe Perches wrote:
> > diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
> > @@ -117,8 +117,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
> >  
> >  	/* Allocate a single memory block for values and addresses. */
> >  	count16 = 2*count;
> > -	a16 = (zd_addr_t *) kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)),
> > -		                   GFP_KERNEL);
> > +	a16 = kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)), GFP_KERNEL);
> I believe this is on purpose for sparse.

Perhaps in a previous version, but not now.

$ make C=1 drivers/net/wireless/zd1211rw/zd_chip.o
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CHECK   drivers/net/wireless/zd1211rw/zd_chip.c
include/trace/events/kmem.h:45:1: error: Expected ( after asm
include/trace/events/kmem.h:45:1: error: got goto
include/trace/events/kmem.h:53:1: error: Expected ( after asm
include/trace/events/kmem.h:53:1: error: got goto
include/trace/events/kmem.h:99:1: error: Expected ( after asm
include/trace/events/kmem.h:99:1: error: got goto
include/trace/events/kmem.h:108:1: error: Expected ( after asm
include/trace/events/kmem.h:108:1: error: got goto
include/trace/events/kmem.h:136:1: error: Expected ( after asm
include/trace/events/kmem.h:136:1: error: got goto
include/trace/events/kmem.h:143:1: error: Expected ( after asm
include/trace/events/kmem.h:143:1: error: got goto
include/trace/events/kmem.h:150:1: error: Expected ( after asm
include/trace/events/kmem.h:150:1: error: got goto
include/trace/events/kmem.h:172:1: error: Expected ( after asm
include/trace/events/kmem.h:172:1: error: got goto
include/trace/events/kmem.h:194:1: error: Expected ( after asm
include/trace/events/kmem.h:194:1: error: got goto
include/trace/events/kmem.h:249:1: error: Expected ( after asm
include/trace/events/kmem.h:249:1: error: got goto
include/trace/events/kmem.h:256:1: error: Expected ( after asm
include/trace/events/kmem.h:256:1: error: got goto
include/trace/events/kmem.h:267:1: error: Expected ( after asm
include/trace/events/kmem.h:267:1: error: got goto
include/trace/events/module.h:18:1: error: Expected ( after asm
include/trace/events/module.h:18:1: error: got goto
include/trace/events/module.h:37:1: error: Expected ( after asm
include/trace/events/module.h:37:1: error: got goto
include/trace/events/module.h:79:1: error: Expected ( after asm
include/trace/events/module.h:79:1: error: got goto
include/trace/events/module.h:86:1: error: Expected ( after asm
include/trace/events/module.h:86:1: error: got goto
include/trace/events/module.h:94:1: error: Expected ( after asm
include/trace/events/module.h:94:1: error: got goto
/home/joe/linux/net-next-2.6-2/arch/x86/include/asm/uaccess_32.h:197:9: error: attribute 'error': unknown attribute
include/trace/events/irq.h:37:1: error: Expected ( after asm
include/trace/events/irq.h:37:1: error: got goto
include/trace/events/irq.h:67:1: error: Expected ( after asm
include/trace/events/irq.h:67:1: error: got goto
include/trace/events/irq.h:112:1: error: Expected ( after asm
include/trace/events/irq.h:112:1: error: got goto
include/trace/events/irq.h:126:1: error: Expected ( after asm
include/trace/events/irq.h:126:1: error: got goto
include/trace/events/irq.h:140:1: error: Expected ( after asm
include/trace/events/irq.h:140:1: error: got goto
include/trace/events/kmem.h:45:1: error: need constant string for inline asm
include/trace/events/kmem.h:45:1: error: incompatible types in comparison expression (different address spaces)
include/trace/events/kmem.h:45:1: error: need constant string for inline asm
include/trace/events/kmem.h:45:1: error: incompatible types in comparison expression (different address spaces)
include/trace/events/kmem.h:45:1: error: need constant string for inline asm
include/trace/events/kmem.h:45:1: error: incompatible types in comparison expression (different address spaces)
include/trace/events/kmem.h:45:1: error: need constant string for inline asm
include/trace/events/kmem.h:45:1: error: incompatible types in comparison expression (different address spaces)
  CC      drivers/net/wireless/zd1211rw/zd_chip.o
$ 



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

* Re: [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
  2010-11-28  9:20     ` Joe Perches
@ 2010-11-28  9:30       ` Johannes Berg
  2010-11-28  9:50           ` Joe Perches
  2010-11-28 10:02         ` [PATCH V2 4/4] zd1211rw: document need for kmalloc cast Joe Perches
  0 siblings, 2 replies; 16+ messages in thread
From: Johannes Berg @ 2010-11-28  9:30 UTC (permalink / raw)
  To: Joe Perches
  Cc: Daniel Drake, Ulrich Kunitz, linux-wireless, John W. Linville,
	linux-kernel, netdev

On Sun, 2010-11-28 at 01:20 -0800, Joe Perches wrote:
> On Sun, 2010-11-28 at 10:12 +0100, Johannes Berg wrote:
> > On Sun, 2010-11-28 at 01:05 -0800, Joe Perches wrote:
> > > diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
> > > @@ -117,8 +117,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
> > >  
> > >  	/* Allocate a single memory block for values and addresses. */
> > >  	count16 = 2*count;
> > > -	a16 = (zd_addr_t *) kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)),
> > > -		                   GFP_KERNEL);
> > > +	a16 = kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)), GFP_KERNEL);
> > I believe this is on purpose for sparse.
> 
> Perhaps in a previous version, but not now.
> 
> $ make C=1 drivers/net/wireless/zd1211rw/zd_chip.o
>   CHK     include/linux/version.h
>   CHK     include/generated/utsrelease.h
>   CALL    scripts/checksyscalls.sh
>   CHECK   drivers/net/wireless/zd1211rw/zd_chip.c
> include/trace/events/kmem.h:45:1: error: Expected ( after asm
> include/trace/events/kmem.h:45:1: error: got goto

How do you know? I thought sparse was pretty much not reliable after the
first error it prints.

johannes


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

* Re: [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
@ 2010-11-28  9:50           ` Joe Perches
  0 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2010-11-28  9:50 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Daniel Drake, Ulrich Kunitz, linux-wireless, John W. Linville,
	linux-kernel, netdev

On Sun, 2010-11-28 at 10:30 +0100, Johannes Berg wrote:
> On Sun, 2010-11-28 at 01:20 -0800, Joe Perches wrote:
> > On Sun, 2010-11-28 at 10:12 +0100, Johannes Berg wrote:
> > > On Sun, 2010-11-28 at 01:05 -0800, Joe Perches wrote:
> > > > diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
> > > > @@ -117,8 +117,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
> > > >  	/* Allocate a single memory block for values and addresses. */
> > > >  	count16 = 2*count;
> > > > -	a16 = (zd_addr_t *) kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)),
> > > > -		                   GFP_KERNEL);
> > > > +	a16 = kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)), GFP_KERNEL);
> > > I believe this is on purpose for sparse.
> > Perhaps in a previous version, but not now.
> How do you know? I thought sparse was pretty much not reliable after the
> first error it prints.

Good memory you have Johannes...

http://marc.info/?l=linux-netdev&m=117113743902549&w=3



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

* Re: [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
@ 2010-11-28  9:50           ` Joe Perches
  0 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2010-11-28  9:50 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Daniel Drake, Ulrich Kunitz,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, John W. Linville,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, netdev

On Sun, 2010-11-28 at 10:30 +0100, Johannes Berg wrote:
> On Sun, 2010-11-28 at 01:20 -0800, Joe Perches wrote:
> > On Sun, 2010-11-28 at 10:12 +0100, Johannes Berg wrote:
> > > On Sun, 2010-11-28 at 01:05 -0800, Joe Perches wrote:
> > > > diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
> > > > @@ -117,8 +117,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
> > > >  	/* Allocate a single memory block for values and addresses. */
> > > >  	count16 = 2*count;
> > > > -	a16 = (zd_addr_t *) kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)),
> > > > -		                   GFP_KERNEL);
> > > > +	a16 = kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)), GFP_KERNEL);
> > > I believe this is on purpose for sparse.
> > Perhaps in a previous version, but not now.
> How do you know? I thought sparse was pretty much not reliable after the
> first error it prints.

Good memory you have Johannes...

http://marc.info/?l=linux-netdev&m=117113743902549&w=3


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
  2010-11-28  9:50           ` Joe Perches
  (?)
@ 2010-11-28 10:02           ` Johannes Berg
  2010-11-28 10:13               ` Joe Perches
  -1 siblings, 1 reply; 16+ messages in thread
From: Johannes Berg @ 2010-11-28 10:02 UTC (permalink / raw)
  To: Joe Perches
  Cc: Daniel Drake, Ulrich Kunitz, linux-wireless, John W. Linville,
	linux-kernel, netdev

On Sun, 2010-11-28 at 01:50 -0800, Joe Perches wrote:
> On Sun, 2010-11-28 at 10:30 +0100, Johannes Berg wrote:
> > On Sun, 2010-11-28 at 01:20 -0800, Joe Perches wrote:
> > > On Sun, 2010-11-28 at 10:12 +0100, Johannes Berg wrote:
> > > > On Sun, 2010-11-28 at 01:05 -0800, Joe Perches wrote:
> > > > > diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
> > > > > @@ -117,8 +117,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
> > > > >  	/* Allocate a single memory block for values and addresses. */
> > > > >  	count16 = 2*count;
> > > > > -	a16 = (zd_addr_t *) kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)),
> > > > > -		                   GFP_KERNEL);
> > > > > +	a16 = kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)), GFP_KERNEL);
> > > > I believe this is on purpose for sparse.
> > > Perhaps in a previous version, but not now.
> > How do you know? I thought sparse was pretty much not reliable after the
> > first error it prints.
> 
> Good memory you have Johannes...
> 
> http://marc.info/?l=linux-netdev&m=117113743902549&w=3

I, err, not really, all this isn't making a whole lot of sense to me
right now :-)
The only thing I remembered was that there was something weird with
zd_addr_t ...

Did sparse become more reliable in face of errors?

johannes


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

* [PATCH V2 4/4] zd1211rw: document need for kmalloc cast
  2010-11-28  9:30       ` Johannes Berg
  2010-11-28  9:50           ` Joe Perches
@ 2010-11-28 10:02         ` Joe Perches
  1 sibling, 0 replies; 16+ messages in thread
From: Joe Perches @ 2010-11-28 10:02 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Daniel Drake, Ulrich Kunitz, linux-wireless, John W. Linville,
	linux-kernel, netdev

Signed-off-by: Joe Perches <joe@perches.com>
---

V2: Just document the need for the cast

diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 87a95bc..dd0bb0c 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -117,6 +117,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
 
 	/* Allocate a single memory block for values and addresses. */
 	count16 = 2*count;
+	/* zd_addr_t is __nocast, so the kmalloc needs an explicit cast */
 	a16 = (zd_addr_t *) kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)),
 		                   GFP_KERNEL);
 	if (!a16) {



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

* Re: [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
@ 2010-11-28 10:13               ` Joe Perches
  0 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2010-11-28 10:13 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Daniel Drake, Ulrich Kunitz, John W. Linville, linux-wireless,
	netdev, LKML

On Sun, 2010-11-28 at 11:02 +0100, Johannes Berg wrote:
> On Sun, 2010-11-28 at 01:50 -0800, Joe Perches wrote:
> > Good memory you have Johannes...
> > http://marc.info/?l=linux-netdev&m=117113743902549&w=3
> I, err, not really, all this isn't making a whole lot of sense to me
> right now :-)
> The only thing I remembered was that there was something weird with
> zd_addr_t ...

Yes.  It's marked __nocast.

> Did sparse become more reliable in face of errors?

Apparently not.

If the kmalloc cast in zd_chip is removed:

$ make C=1 drivers/net/wireless/zd1211rw/zd_chip.o
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CHECK   drivers/net/wireless/zd1211rw/zd_chip.c
arch/x86/include/asm/uaccess_32.h:197:9: error: attribute 'error': unknown attribute
  CC      drivers/net/wireless/zd1211rw/zd_chip.o
$

If the __compiletime_<foo> uses in uaccess_32.h are removed,
and the kmalloc cast in zd_chip is also removed:

$ make C=1 drivers/net/wireless/zd1211rw/zd_chip.o
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      arch/x86/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHECK   drivers/net/wireless/zd1211rw/zd_chip.c
drivers/net/wireless/zd1211rw/zd_chip.c:121:22: warning: implicit cast to nocast type
  CC      drivers/net/wireless/zd1211rw/zd_chip.o
$


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

* Re: [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
@ 2010-11-28 10:13               ` Joe Perches
  0 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2010-11-28 10:13 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Daniel Drake, Ulrich Kunitz, John W. Linville,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, netdev, LKML

On Sun, 2010-11-28 at 11:02 +0100, Johannes Berg wrote:
> On Sun, 2010-11-28 at 01:50 -0800, Joe Perches wrote:
> > Good memory you have Johannes...
> > http://marc.info/?l=linux-netdev&m=117113743902549&w=3
> I, err, not really, all this isn't making a whole lot of sense to me
> right now :-)
> The only thing I remembered was that there was something weird with
> zd_addr_t ...

Yes.  It's marked __nocast.

> Did sparse become more reliable in face of errors?

Apparently not.

If the kmalloc cast in zd_chip is removed:

$ make C=1 drivers/net/wireless/zd1211rw/zd_chip.o
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CHECK   drivers/net/wireless/zd1211rw/zd_chip.c
arch/x86/include/asm/uaccess_32.h:197:9: error: attribute 'error': unknown attribute
  CC      drivers/net/wireless/zd1211rw/zd_chip.o
$

If the __compiletime_<foo> uses in uaccess_32.h are removed,
and the kmalloc cast in zd_chip is also removed:

$ make C=1 drivers/net/wireless/zd1211rw/zd_chip.o
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      arch/x86/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHECK   drivers/net/wireless/zd1211rw/zd_chip.c
drivers/net/wireless/zd1211rw/zd_chip.c:121:22: warning: implicit cast to nocast type
  CC      drivers/net/wireless/zd1211rw/zd_chip.o
$

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0/4] drivers/net: Remove unnecessary [kv][mcz]alloc casts
  2010-11-28  9:05 [PATCH 0/4] drivers/net: Remove unnecessary [kv][mcz]alloc casts Joe Perches
                   ` (3 preceding siblings ...)
  2010-11-28  9:05   ` Joe Perches
@ 2010-11-29  1:26 ` David Miller
  4 siblings, 0 replies; 16+ messages in thread
From: David Miller @ 2010-11-29  1:26 UTC (permalink / raw)
  To: joe; +Cc: netdev, linux-wireless, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Sun, 28 Nov 2010 01:05:42 -0800

> These are the last remaining alloc casts in drivers/net...
> 
> Joe Perches (4):
>   netxen: remove unnecessary [kv][mcz]alloc casts
>   qlcnic: remove unnecessary [kv][mcz]alloc casts
>   vxge: remove unnecessary [kv][mcz]alloc casts
>   zd1211rw: remove unnecessary [kv][mcz]alloc casts

All applied, using v2 of patch #4.

Thanks.

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

end of thread, other threads:[~2010-11-29  1:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-28  9:05 [PATCH 0/4] drivers/net: Remove unnecessary [kv][mcz]alloc casts Joe Perches
2010-11-28  9:05 ` [PATCH 1/4] netxen: remove " Joe Perches
2010-11-28  9:05 ` [PATCH 2/4] qlcnic: " Joe Perches
2010-11-28  9:05 ` [PATCH 3/4] vxge: " Joe Perches
2010-11-28  9:05 ` [PATCH 4/4] zd1211rw: " Joe Perches
2010-11-28  9:05   ` Joe Perches
2010-11-28  9:12   ` Johannes Berg
2010-11-28  9:20     ` Joe Perches
2010-11-28  9:30       ` Johannes Berg
2010-11-28  9:50         ` Joe Perches
2010-11-28  9:50           ` Joe Perches
2010-11-28 10:02           ` Johannes Berg
2010-11-28 10:13             ` Joe Perches
2010-11-28 10:13               ` Joe Perches
2010-11-28 10:02         ` [PATCH V2 4/4] zd1211rw: document need for kmalloc cast Joe Perches
2010-11-29  1:26 ` [PATCH 0/4] drivers/net: Remove unnecessary [kv][mcz]alloc casts David Miller

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.