Commit 5349d3d8 authored by Thomas Meyer's avatar Thomas Meyer Committed by Greg Kroah-Hartman

staging: brcm80211: use kzalloc()

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: default avatarThomas Meyer <thomas@m3y3r.de>
Acked-by: default avatarRoland Vossen <rvossen@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5a84d6ad
...@@ -5644,14 +5644,12 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs) ...@@ -5644,14 +5644,12 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs)
BRCMF_TRACE(("%s: Enter\n", __func__)); BRCMF_TRACE(("%s: Enter\n", __func__));
/* alloc chip_info_t */ /* alloc chip_info_t */
ci = kmalloc(sizeof(struct chip_info), GFP_ATOMIC); ci = kzalloc(sizeof(struct chip_info), GFP_ATOMIC);
if (NULL == ci) { if (NULL == ci) {
BRCMF_ERROR(("%s: malloc failed!\n", __func__)); BRCMF_ERROR(("%s: malloc failed!\n", __func__));
return -ENOMEM; return -ENOMEM;
} }
memset((unsigned char *)ci, 0, sizeof(struct chip_info));
/* bus/core/clk setup for register access */ /* bus/core/clk setup for register access */
/* Try forcing SDIO core to do ALPAvail request only */ /* Try forcing SDIO core to do ALPAvail request only */
clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ; clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment