From patchwork Sun Dec 17 06:43:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10117647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C26346019C for ; Sun, 17 Dec 2017 06:53:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE558292A0 for ; Sun, 17 Dec 2017 06:53:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A008929357; Sun, 17 Dec 2017 06:53:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8E4F5292A0 for ; Sun, 17 Dec 2017 06:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9c6hEowyEy9JxxrZ5wfVuaVYacVuaI/r3z+4JsCkZe4=; b=hmyYzcdx5uHtj7 IMCpct27+FQ/Gss/8Fm6srp3Drr4D1muBo1JLCUFYrjsDb9au2NSVRQkBMFehojVzg5htfOTR8dU5 6239FCkeqDGjZyJHt6YMyOERmKMDQAoyK4ruJbrpsU3IhrW3idz04zw5KPX+BJNHLN1yXnSmxig1g AFEMWAandPguDIPjx6E4TfCy5oxyxpucCCE1U6fRjjC7TsTL2ewueIibWUW8PnTVlQv7UPzMNM7nS 1DnVkVG8ZKfdbwQVAgbks1LYzrlT3EjCWiajtx6idn3EsNjKQt+p01aa+ErkwsYgK7GaPyhoCIzYm 3k7zO4u/bAq9y0EdaboQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eQSoq-0004pE-Ij; Sun, 17 Dec 2017 06:53:04 +0000 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eQSol-0004mu-Go for linux-arm-kernel@lists.infradead.org; Sun, 17 Dec 2017 06:53:02 +0000 X-IronPort-AV: E=Sophos;i="5.45,414,1508796000"; d="scan'208";a="248619873" Received: from abo-202-111-68.mrs.modulonet.fr (HELO [192.168.0.15]) ([85.68.111.202]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Dec 2017 07:43:10 +0100 Date: Sun, 17 Dec 2017 07:43:10 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Linus Walleij Subject: [PATCH] net: ethernet: fix call_kern.cocci warnings Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171216_225259_909973_FC8A1C06 X-CRM114-Status: GOOD ( 10.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kbuild-all@01.org, linux-arm-kernel@lists.infradead.org, =?ISO-8859-2?Q?Micha=B3_Miros=B3aw?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fengguang Wu Allocation with GFP_KERNEL in code called from the function geth_resize_freeq with locks held. Generated by: scripts/coccinelle/locks/call_kern.cocci Fixes: 502a2864e5e4 ("net: ethernet: Add a driver for Gemini gigabit ethernet") Signed-off-by: Fengguang Wu Signed-off-by: Julia Lawall --- The proposed change of converting the GFP_KERNEL is not necessarily the correct one. It may be desired to unlock the lock, or to not call the function under the lock in the first place. tree: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git gemini-ethernet head: 502a2864e5e43c51a3a2689586d9c61d060a3b7d commit: 502a2864e5e43c51a3a2689586d9c61d060a3b7d [18/18] net: ethernet: Add a driver for Gemini gigabit ethernet gemini.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -818,7 +818,7 @@ static int geth_setup_freeq(struct gemin geth->freeq_ring = dma_alloc_coherent(geth->dev, sizeof(*geth->freeq_ring) << geth->freeq_order, - &geth->freeq_dma_base, GFP_KERNEL); + &geth->freeq_dma_base, GFP_ATOMIC); if (!geth->freeq_ring) return -ENOMEM; if (geth->freeq_dma_base & ~DMA_Q_BASE_MASK) { @@ -827,7 +827,7 @@ static int geth_setup_freeq(struct gemin } geth->freeq_page_tab = kzalloc(pages * sizeof(*geth->freeq_page_tab), - GFP_KERNEL); + GFP_ATOMIC); if (!geth->freeq_page_tab) goto err_freeq;