From: Jesper Juhl <jesper.juhl@gmail.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>,
Jesper Juhl <jesper.juhl@gmail.com>,
Marc St-Jean <stjeanma@pmc-sierra.com>,
linux-mtd@lists.infradead.org,
"Robert P. J. Day" <rpjday@mindspring.com>
Subject: [PATCH 1/4] mtd: Don't cast kmalloc() return value in drivers/mtd/maps/pmcmsp-flash.c
Date: Sun, 26 Aug 2007 03:54:27 +0200 [thread overview]
Message-ID: <200708260354.27928.jesper.juhl@gmail.com> (raw)
In-Reply-To: <200708260352.33343.jesper.juhl@gmail.com>
mtd: Don't cast kmalloc() return value in drivers/mtd/maps/pmcmsp-flash.c
kmalloc() returns a void pointer.
No need to cast it.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
drivers/mtd/maps/pmcmsp-flash.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/maps/pmcmsp-flash.c b/drivers/mtd/maps/pmcmsp-flash.c
index 7e0377e..dfdb120 100644
--- a/drivers/mtd/maps/pmcmsp-flash.c
+++ b/drivers/mtd/maps/pmcmsp-flash.c
@@ -73,12 +73,9 @@ int __init init_msp_flash(void)
return -ENXIO;
printk(KERN_NOTICE "Found %d PMC flash devices\n", fcnt);
- 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));
/* loop over the flash devices, initializing each */
@@ -95,8 +92,8 @@ int __init init_msp_flash(void)
continue;
}
- 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 */
next prev parent reply other threads:[~2007-08-26 2:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-26 1:52 [PATCH 0/4] mtd: cleanups and small bug fixes for init_msp_flash() Jesper Juhl
2007-08-26 1:54 ` Jesper Juhl [this message]
2007-08-26 1:55 ` [PATCH 2/4] mtd: convert some kmalloc()+memset() calls to kcalloc() in drivers/mtd/maps/pmcmsp-flash.c Jesper Juhl
2007-08-26 1:56 ` [PATCH 3/4] mtd: Fix a potential NULL ptr deref bug and mem leak in init_msp_flash() Jesper Juhl
2007-08-26 1:57 ` [PATCH 4/4] mtd: Check for allocation failures and bail out appropriately " Jesper Juhl
2007-08-26 8:36 ` [PATCH 1/4] mtd: Don't cast kmalloc() return value in drivers/mtd/maps/pmcmsp-flash.c Robert P. J. Day
2007-08-26 13:19 ` Jesper Juhl
2007-08-26 15:41 ` Robert P. J. Day
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=200708260354.27928.jesper.juhl@gmail.com \
--to=jesper.juhl@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=rpjday@mindspring.com \
--cc=stjeanma@pmc-sierra.com \
--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