Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752639AbbLUW4d (ORCPT ); Mon, 21 Dec 2015 17:56:33 -0500 Received: from mail-io0-f178.google.com ([209.85.223.178]:33292 "EHLO mail-io0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751566AbbLUW4a (ORCPT ); Mon, 21 Dec 2015 17:56:30 -0500 MIME-Version: 1.0 In-Reply-To: <1450716464-20759-1-git-send-email-hofrat@osadl.org> References: <1450716464-20759-1-git-send-email-hofrat@osadl.org> From: Julian Calaby Date: Tue, 22 Dec 2015 09:56:10 +1100 Message-ID: Subject: Re: [PATCH] wlcore: consolidate kmalloc + memset 0 into kzalloc To: Nicholas Mc Guire Cc: Kalle Valo , Eliad Peller , Johannes Berg , Arik Nemtsov , Tony Lindgren , Luciano Coelho , Eyal Reizer , Emmanuel Grumbach , linux-wireless , netdev , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2331 Lines: 67 Hi, On Tue, Dec 22, 2015 at 3:47 AM, Nicholas Mc Guire wrote: > This is an API consolidation only. The use of kmalloc + memset to 0 > is equivalent to kzalloc. > > Signed-off-by: Nicholas Mc Guire > --- > > Found by coccinelle script (relaxed version of > scripts/coccinelle/api/alloc/kzalloc-simple.cocci) > > Patch was compile tested with: x86_64_defconfig + > CONFIG_WL12XX=m (implies CONFIG_WLCORE=m) > > Patch is against linux-next (localversion-next is -next-20151221) > > drivers/net/wireless/ti/wlcore/main.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c > index ec7f6af..dfc49bf 100644 > --- a/drivers/net/wireless/ti/wlcore/main.c > +++ b/drivers/net/wireless/ti/wlcore/main.c > @@ -838,7 +838,7 @@ static void wl12xx_read_fwlog_panic(struct wl1271 *wl) > > wl1271_info("Reading FW panic log"); > > - block = kmalloc(wl->fw_mem_block_size, GFP_KERNEL); > + block = kzalloc(wl->fw_mem_block_size, GFP_KERNEL); > if (!block) > return; > > @@ -885,7 +885,6 @@ static void wl12xx_read_fwlog_panic(struct wl1271 *wl) > goto out; > } > - memset(block, 0, wl->fw_mem_block_size); I don't think you can't remove this line. It appears that the loop this is part of resets block to be all zero, reads a chunk of data in, then operates on it. I'm guessing that the code after the following line expects that there isn't any data left over from previous runs through the loop. > ret = wlcore_read_hwaddr(wl, addr, block, > wl->fw_mem_block_size, false); > > -- > 2.1.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-wireless" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/