public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Denys Vlasenko <vda.linux@googlemail.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Jesper Juhl <jesper.juhl@gmail.com>,
	linux-mtd@lists.infradead.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 09/30] mtd: Don't cast kmalloc() return value in drivers/mtd/maps/pmcmsp-flash.c
Date: Fri, 24 Aug 2007 06:43:33 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0708240642500.18301@localhost.localdomain> (raw)
In-Reply-To: <200708241141.06358.vda.linux@googlemail.com>

On Fri, 24 Aug 2007, Denys Vlasenko wrote:

> On Friday 24 August 2007 00:52, Jesper Juhl wrote:
> > kmalloc() returns a void pointer.
> > No need to cast it.
>
> > -	msp_flash = (struct mtd_info **)kmalloc(
> > -			fcnt * sizeof(struct map_info *), GFP_KERNEL);
> > -	msp_parts = (struct mtd_partition **)kmalloc(
> > -			fcnt * sizeof(struct mtd_partition *), GFP_KERNEL);
> > -	msp_maps = (struct map_info *)kmalloc(
> > -			fcnt * sizeof(struct mtd_info), GFP_KERNEL);
> > +	msp_flash = kmalloc(fcnt * sizeof(struct map_info *), GFP_KERNEL);
> > +	msp_parts = kmalloc(fcnt * sizeof(struct mtd_partition *), GFP_KERNEL);
> > +	msp_maps = kmalloc(fcnt * sizeof(struct mtd_info), GFP_KERNEL);
> >  	memset(msp_maps, 0, fcnt * sizeof(struct mtd_info));
>
> This one wants kzalloc.
>
> > -		msp_parts[i] = (struct mtd_partition *)kmalloc(
> > -			pcnt * sizeof(struct mtd_partition), GFP_KERNEL);
> > +		msp_parts[i] = kmalloc(pcnt * sizeof(struct mtd_partition),
> > +			GFP_KERNEL);
> >  		memset(msp_parts[i], 0, pcnt * sizeof(struct mtd_partition));
> >
> >  		/* now initialize the devices proper */
>
> Same

actually, i would think kcalloc would be more appropriate here, no?

rday
-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================

  reply	other threads:[~2007-08-24 10:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1554af80879a7ef2f78a4d654f23c248203500d9.1187912217.git.jesper.juhl@gmail.com>
2007-08-23 23:50 ` [PATCH 07/30] mtd: Get rid of pointless cast of kzalloc() return value in AT26xxx driver Jesper Juhl
2007-08-23 23:51 ` [PATCH 08/30] mtd: Avoid a pointless kmalloc() return value cast in TQM8xxL mapping handling code Jesper Juhl
2007-08-23 23:52 ` [PATCH 09/30] mtd: Don't cast kmalloc() return value in drivers/mtd/maps/pmcmsp-flash.c Jesper Juhl
2007-08-24 10:41   ` Denys Vlasenko
2007-08-24 10:43     ` Robert P. J. Day [this message]
2007-08-25 22:27       ` Jesper Juhl
2007-08-25 23:59         ` Robert P. J. Day
2007-08-26  0:28           ` Jesper Juhl
2007-08-26  0:23             ` Robert P. J. Day
2007-08-26  0:36               ` Jesper Juhl
2007-08-26  1:52                 ` Kyle Moffett
2007-08-26 14:28               ` Denys Vlasenko
2007-08-26 14:37                 ` Jan Engelhardt
2007-08-26 22:10                   ` Jesper Juhl
2007-08-24 10:48     ` Jesper Juhl

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=Pine.LNX.4.64.0708240642500.18301@localhost.localdomain \
    --to=rpjday@mindspring.com \
    --cc=dwmw2@infradead.org \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=vda.linux@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox