Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp517160imm; Fri, 27 Jul 2018 00:59:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd7XXJ450q1iU5Jwn1kIDeFjskJ8hD9NzWKfz9/zCq0bV3jcaGtW5+GjiVLA/toCKztpSVh X-Received: by 2002:a63:d80f:: with SMTP id b15-v6mr5140254pgh.347.1532678352241; Fri, 27 Jul 2018 00:59:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532678352; cv=none; d=google.com; s=arc-20160816; b=rHmXwyDcmwyf8HLHJ+pIxyFV9AiPfryCtUKoJ07mnEn/qxHC0b9HxO3DyR54vuYU0Y WMUiN2GWJtbE5ck0n0/dEp9J4LB88T8Ax9TIMUdKyBlKkN1Ok8rSQpLM8tKlJi+6HI0y lpKXNMPgfcZflQLo0zXqLRnGmZQcrXax8VwOw4fKixT3Jq0uyJZtVVMjkW9bcF2/5Ye9 M4Uz/EAXitMyikzbK8K7hcQB3Y1ysizejz6a01IRHbiT7nZV0AhHBN13/MtyLlrEf7S3 Mskd/tCB4VK/McVUU4Ng1/zzk9xfDzWZOCAcWuIg8cpz8nekLpC1Gr1HTz8gEoJBEDjb qO4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=j7f3ERZyPaSHj9gk4RlUSMm2ft1Z22gVA5iESHvdbuc=; b=VAjLKdOOqoGHyqlbEPg2S1arW+GsgVdLWzDn/V6OUV+4mYbmrUbJdtYUPuK/sHihNt WJ2bLQwz6w0qO2R5WvFnhaa4UkLYIgU8kRKQsk1YjSjf464Rex7WlcKKMqwJz36ZHpac npRZBAjJnxRbfdgCMPSE95YdnN9GaK++V3dvIT4oC7TNB5ylGc07e41YSoTdX/++40Nf fXLUlSpzivlPcLxFzxYQQPd78E2yVTeObjxrxUF/ZwdRHhdnnEFqpTfQjhZBChe50mP/ Y9ocvEiurxK6kvtAVmntsCs+2XYGD2hunUEPPzpq4DG8eAycmlPO9hlRzu9GzK7e/Fii LY2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TiNCNhL1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e20-v6si3730837pfm.177.2018.07.27.00.58.56; Fri, 27 Jul 2018 00:59:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TiNCNhL1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730205AbeG0JSq (ORCPT + 99 others); Fri, 27 Jul 2018 05:18:46 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:35410 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729445AbeG0JSq (ORCPT ); Fri, 27 Jul 2018 05:18:46 -0400 Received: by mail-pl0-f68.google.com with SMTP id w3-v6so1982991plq.2; Fri, 27 Jul 2018 00:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=j7f3ERZyPaSHj9gk4RlUSMm2ft1Z22gVA5iESHvdbuc=; b=TiNCNhL1wjzYSjp1Cv9oiO9Lh+Wo+BJ6JDrMoDX2C534KT/wK2bv11okEPXYvC3OBO Lw4yuq+2qDCHMv+jrMDzzZ0Ly+fgRbPS/azVqHS5ubC8gMZr/ClU+qwptPJLRMcUVGXk XZkiuJnCh11vLDLCNmcUWchjRLzDlU2JQhctd7tMMkBBOoluSiac1Z1U8yCAcgydAabt 6i4YnvelYv3L4le3+4c15Bl4nLQnQbJrlTT6+wuR4koqNvcoZuzOmIGhKDLM10cGYkh6 1U1tyGGy7En3BFqdXBaZ9aYuaPGT3TcXHX9BTPVfOE/jpOIyaCxScd2WTanRBnlgz8Jq 64/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=j7f3ERZyPaSHj9gk4RlUSMm2ft1Z22gVA5iESHvdbuc=; b=iKRwe+oT4tY7P7FnEI8gQAbgUegGSD9990Ddm6oI0EkF5tmNlabue6KAMMaAtnVFZb 1TXMXQR+cE98V4eZ0t0WixhAGLDD0CbRFXuUzMQsgoCGrsy48pKFHjq/X2rMZiUgtMYk kJvEInLA3lnyjPgSrTdqs8vylDIQfcQuQZ817QNbFAuQ57NRRXhW7aV5AQOKtYPNa+Yd ua4tUhoI4glbd47o1uqq9CjQYlVKmlkWexVpZqKR9eyKnEBD3dTC7HdNw6kHzGeqjjgw uvu45vhgXJhuxfqcYrsnMYpkc+P7cujEaZ7ZL3/qWIeCTeTwLEkcN2O9D7PagIQyG5O8 YuAA== X-Gm-Message-State: AOUpUlEMO2v8+8S+oL2KR75nFWAIP+mfU8+NCun7Jw3Ppa02SQm6Gk+T zc+5pB9ltsZTZ16XHKVmSp4= X-Received: by 2002:a17:902:7891:: with SMTP id q17-v6mr5164643pll.186.1532678285135; Fri, 27 Jul 2018 00:58:05 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:6c14:7712:e625:1be4]) by smtp.gmail.com with ESMTPSA id p17-v6sm3722165pgv.26.2018.07.27.00.58.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 00:58:04 -0700 (PDT) From: Jia-Ju Bai To: pcnet32@frontier.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: amd: pcnet32: Replace GFP_ATOMIC with GFP_KERNEL in pcnet32_alloc_ring() Date: Fri, 27 Jul 2018 15:57:58 +0800 Message-Id: <20180727075758.2516-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pcnet32_alloc_ring() is never called in atomic context. It calls kcalloc() with GFP_ATOMIC, which is not necessary. GFP_ATOMIC can be replaced with GFP_KERNEL. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/net/ethernet/amd/pcnet32.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c index a561705f232c..e69e810d211d 100644 --- a/drivers/net/ethernet/amd/pcnet32.c +++ b/drivers/net/ethernet/amd/pcnet32.c @@ -2032,22 +2032,22 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) } lp->tx_dma_addr = kcalloc(lp->tx_ring_size, sizeof(dma_addr_t), - GFP_ATOMIC); + GFP_KERNEL); if (!lp->tx_dma_addr) return -ENOMEM; lp->rx_dma_addr = kcalloc(lp->rx_ring_size, sizeof(dma_addr_t), - GFP_ATOMIC); + GFP_KERNEL); if (!lp->rx_dma_addr) return -ENOMEM; lp->tx_skbuff = kcalloc(lp->tx_ring_size, sizeof(struct sk_buff *), - GFP_ATOMIC); + GFP_KERNEL); if (!lp->tx_skbuff) return -ENOMEM; lp->rx_skbuff = kcalloc(lp->rx_ring_size, sizeof(struct sk_buff *), - GFP_ATOMIC); + GFP_KERNEL); if (!lp->rx_skbuff) return -ENOMEM; -- 2.17.0