* [PATCH] staging: brcm80211: use kzalloc()
@ 2011-08-06 11:26 Thomas Meyer
2011-08-08 12:00 ` Roland Vossen
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Meyer @ 2011-08-06 11:26 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, Linux Kernel Mailing List
From: Thomas Meyer <thomas@m3y3r.de>
Use kzalloc rather than kmalloc followed by memset with 0
This considers some simple cases that are common and easy to validate
Note in particular that there are no ...s in the rule, so all of the
matched code has to be contiguous
The semantic patch that makes this output is available
in scripts/coccinelle/api/alloc/kzalloc-simple.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c 2011-07-28 15:32:17.863253745 +0200
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c 2011-08-01 20:25:55.608031978 +0200
@@ -6326,14 +6326,12 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bu
BRCMF_TRACE(("%s: Enter\n", __func__));
/* alloc chip_info_t */
- ci = kmalloc(sizeof(struct chip_info), GFP_ATOMIC);
+ ci = kzalloc(sizeof(struct chip_info), GFP_ATOMIC);
if (NULL == ci) {
BRCMF_ERROR(("%s: malloc failed!\n", __func__));
return -ENOMEM;
}
- memset((unsigned char *)ci, 0, sizeof(struct chip_info));
-
/* bus/core/clk setup for register access */
/* Try forcing SDIO core to do ALPAvail request only */
clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: brcm80211: use kzalloc()
2011-08-06 11:26 [PATCH] staging: brcm80211: use kzalloc() Thomas Meyer
@ 2011-08-08 12:00 ` Roland Vossen
0 siblings, 0 replies; 2+ messages in thread
From: Roland Vossen @ 2011-08-08 12:00 UTC (permalink / raw)
To: Thomas Meyer
Cc: Greg Kroah-Hartman, devel@driverdev.osuosl.org,
Linux Kernel Mailing List
> Signed-off-by: Thomas Meyer<thomas@m3y3r.de>
Acked-by: Roland Vossen <rvossen@broadcom.com>
> ---
>
> diff -u -p a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
> --- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c 2011-07-28 15:32:17.863253745 +0200
> +++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c 2011-08-01 20:25:55.608031978 +0200
> @@ -6326,14 +6326,12 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bu
> BRCMF_TRACE(("%s: Enter\n", __func__));
>
> /* alloc chip_info_t */
> - ci = kmalloc(sizeof(struct chip_info), GFP_ATOMIC);
> + ci = kzalloc(sizeof(struct chip_info), GFP_ATOMIC);
> if (NULL == ci) {
> BRCMF_ERROR(("%s: malloc failed!\n", __func__));
> return -ENOMEM;
> }
>
> - memset((unsigned char *)ci, 0, sizeof(struct chip_info));
> -
> /* bus/core/clk setup for register access */
> /* Try forcing SDIO core to do ALPAvail request only */
> clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ;
>
>
>
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-08 12:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-06 11:26 [PATCH] staging: brcm80211: use kzalloc() Thomas Meyer
2011-08-08 12:00 ` Roland Vossen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox