public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Drake <dsd-aBrp7R+bbdUdnm+yROfE0A@public•gmane.org>
To: Jesper Juhl <jesper.juhl-Re5JQEeQqe8AvxtiuMwx3w@public•gmane.org>
Cc: Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public•gmane.org>,
	netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public•gmane.org>,
	Ulrich Kunitz <kune-hUSrv6EASfkEnNRfnnE9gw@public•gmane.org>,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
Subject: Re: [PATCH 13/30] net: Don't do pointless kmalloc return value casts in zd1211 driver
Date: Thu, 30 Aug 2007 13:54:47 -0400	[thread overview]
Message-ID: <46D70467.1040109@gentoo.org> (raw)
In-Reply-To: <d551047daed1cb4d9de1eff956268a468c9837f6.1187912217.git.jesper.juhl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Jesper Juhl wrote:
> Since kmalloc() returns a void pointer there is no reason to cast
> its return value.
> This patch also removes a pointless initialization of a variable.

NAK: adds a sparse warning
zd_chip.c:116:15: warning: implicit cast to nocast type

> Signed-off-by: Jesper Juhl <jesper.juhl-Re5JQEeQqe8AvxtiuMwx3w@public•gmane.org>
> ---
>  drivers/net/wireless/zd1211rw/zd_chip.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
> index c39f198..4942e5c 100644
> --- a/drivers/net/wireless/zd1211rw/zd_chip.c
> +++ b/drivers/net/wireless/zd1211rw/zd_chip.c
> @@ -106,8 +106,8 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
>  {
>  	int r;
>  	int i;
> -	zd_addr_t *a16 = (zd_addr_t *)NULL;
>  	u16 *v16;
> +	zd_addr_t *a16;
>  	unsigned int count16;
>  
>  	if (count > USB_MAX_IOREAD32_COUNT)
> @@ -115,8 +115,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");

  parent reply	other threads:[~2007-08-30 17:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1554af80879a7ef2f78a4d654f23c248203500d9.1187912217.git.jesper.juhl@gmail.com>
     [not found] ` <1554af80879a7ef2f78a4d654f23c248203500d9.1187912217.git.jesper.juhl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2007-08-24  0:03   ` [PATCH 14/30] net: Kill some unneeded allocation return value casts in libertas Jesper Juhl
     [not found]     ` <2ac91f5f0eed967cf1709cfbe476b351e536c299.1187912217.git.jesper.juhl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2007-08-24 15:50       ` Dan Williams
2007-08-24  0:06 ` [PATCH 16/30] net: Avoid pointless allocation casts in BSD compression module Jesper Juhl
2007-08-25  6:25   ` David Miller
     [not found] ` <c4e095af9df5ab47e7d1c8e4f3d256d74576a0c9.1187912217.git.jesper.juhl@gmail.com>
2007-08-24  7:25   ` [PATCH 12/30] net: No point in casting kmalloc return values in Gianfar Ethernet Driver Kumar Gala
     [not found] ` <d551047daed1cb4d9de1eff956268a468c9837f6.1187912217.git.jesper.juhl@gmail.com>
     [not found]   ` <d551047daed1cb4d9de1eff956268a468c9837f6.1187912217.git.jesper.juhl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2007-08-30 17:54     ` Daniel Drake [this message]
     [not found]       ` <46D70467.1040109-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2007-08-30 20:20         ` [PATCH 13/30] net: Don't do pointless kmalloc return value casts in zd1211 driver Jesper Juhl
2007-08-30 23:47           ` Daniel Drake
     [not found]           ` <9a8748490708301320o49d8e794vc5c37ffc938006f1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-08-30 22:19             ` Joe Perches
2007-08-30 22:30               ` [PATCH] Don't needlessly initialize variable to NULL in zd_chip (was: Re: [PATCH 13/30] net: Don't do pointless kmalloc return value casts in zd1211 driver) Jesper Juhl
     [not found]                 ` <200708310030.31713.jesper.juhl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2007-08-30 22:42                   ` Randy Dunlap
     [not found]                     ` <20070830154255.6a146c21.randy.dunlap-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2007-08-30 23:04                       ` Jesper Juhl
2007-08-31  9:30             ` [PATCH 13/30] net: Don't do pointless kmalloc return value casts in zd1211 driver Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46D70467.1040109@gentoo.org \
    --to=dsd-abrp7r+bbdudnm+yrofe0a@public$(echo .)gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public$(echo .)gmane.org \
    --cc=jesper.juhl-Re5JQEeQqe8AvxtiuMwx3w@public$(echo .)gmane.org \
    --cc=kune-hUSrv6EASfkEnNRfnnE9gw@public$(echo .)gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox