linux-wireless.vger.kernel.org archive mirror
 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 4/4] zd1211rw: remove " Joe Perches
  2010-11-29  1:26 ` [PATCH 0/4] drivers/net: Remove unnecessary [kv][mcz]alloc casts David Miller
  0 siblings, 2 replies; 10+ 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] 10+ messages in thread

* [PATCH 4/4] zd1211rw: 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:12   ` Johannes Berg
  2010-11-29  1:26 ` [PATCH 0/4] drivers/net: Remove unnecessary [kv][mcz]alloc casts David Miller
  1 sibling, 1 reply; 10+ 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] 10+ messages in thread

* Re: [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
  2010-11-28  9:05 ` [PATCH 4/4] zd1211rw: remove " Joe Perches
@ 2010-11-28  9:12   ` Johannes Berg
  2010-11-28  9:20     ` Joe Perches
  0 siblings, 1 reply; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ messages in thread

* Re: [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
  2010-11-28  9:30       ` Johannes Berg
@ 2010-11-28  9:50         ` Joe Perches
  2010-11-28 10:02           ` Johannes Berg
  2010-11-28 10:02         ` [PATCH V2 4/4] zd1211rw: document need for kmalloc cast Joe Perches
  1 sibling, 1 reply; 10+ 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] 10+ 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
  0 siblings, 1 reply; 10+ 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] 10+ 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; 10+ 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] 10+ messages in thread

* Re: [PATCH 4/4] zd1211rw: remove unnecessary [kv][mcz]alloc casts
  2010-11-28 10:02           ` Johannes Berg
@ 2010-11-28 10:13             ` Joe Perches
  0 siblings, 0 replies; 10+ 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] 10+ 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
  2010-11-28  9:05 ` [PATCH 4/4] zd1211rw: remove " Joe Perches
@ 2010-11-29  1:26 ` David Miller
  1 sibling, 0 replies; 10+ 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] 10+ messages in thread

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

Thread overview: 10+ 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 4/4] zd1211rw: remove " 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 10:02           ` Johannes Berg
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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).