Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp321373imm; Thu, 26 Jul 2018 20:08:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdCSmAhbTd7y9YS7oz2qPR8RI9uUMBg8UNX+qHLqfSOwFtbSD+fRazwUoIRvRhrNVuxgM2B X-Received: by 2002:a17:902:925:: with SMTP id 34-v6mr4379352plm.103.1532660894389; Thu, 26 Jul 2018 20:08:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532660894; cv=none; d=google.com; s=arc-20160816; b=dZv13awWF1JL+2WfUd46zwt0en5bxAlL8eY4YBjkYCZ+1nfYn3uKu/XkdMTb6rqplg W+fHUVGhXI6Zq8BGtZ3zP/l8FWQDXFA+lXB2PTpM7dQ6mp5hio5unoQFA6umMW2CPN1A pTpTT8afV6p7DQfNk7AVgKwVi8QxH/YXn339654d114bWQZe5eUP4CMW0AN2ZP8qeQ1h QVv26xsJwUHrYWDnvKodOzdyQZJUdNl+DwkNsJA5d85H/O94IuuGPduzLh5XDdfsgfWg 4WZEkzxTUP7b+UJvOXQjkSbdrLVJ+yttes7Ghr6AJoxvWKd8EtR06mNZi0umzQrGGOFi yWtw== 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=I1w2fTWFH6D5/xRWuf1sz/hQSAip5UyfHVE49QGVzkg=; b=Dvb9Mrsd1z3UKwxqBxiJGRPb6Stqs/40udAXvCpI4u26iarQqN1FQvzeBAE6E1eoTy 7hx9qP85BkDX/RCEmjqTl0sNBEjr4s8n3qGcNMfKtcJl2Pasj+oW2VDdxg12vZeW14ob t/C8esuyWU8+m314caWjR4G1KDsMDE7jvuXXsYcPP2fNYVRmR8EBzewoYrKZxVutvAvI 96n3X3v0BCS/65cZh2DmAzF6qBbF4opq4ietqLcJaAPxGhUV8NfuBs2Om9dItIBexaKj 791mRSFvb+14jVpPK3NRMN7XaLveOhiIRtk5Kuv2tVp8I3JB0Wmd0PywbAwg2SYiOzDj tOWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=l3KAphno; 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 v16-v6si2754116pfm.341.2018.07.26.20.07.59; Thu, 26 Jul 2018 20:08:14 -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=l3KAphno; 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 S1727384AbeG0E0y (ORCPT + 99 others); Fri, 27 Jul 2018 00:26:54 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:34997 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725861AbeG0E0y (ORCPT ); Fri, 27 Jul 2018 00:26:54 -0400 Received: by mail-pl0-f67.google.com with SMTP id w3-v6so1685324plq.2; Thu, 26 Jul 2018 20:07:11 -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=I1w2fTWFH6D5/xRWuf1sz/hQSAip5UyfHVE49QGVzkg=; b=l3KAphnoSQ2or9bdIlsZ8TKg2YKinzsl4nlU7HbUkZnz4noNIry2aE3NkT2kEDAexU HljbBe5unwzg7DlJvXxGrSu/Xh02lOX6L3wFByAHGxkuzM5ubd87uv9wRR6OYgqe98or W/otLvbxJp4tAwppQzu3NXW6PUDQhUSKlV2ZOdjK/qIaZbcDbsFfgpG7XLvGIfIXQFq9 zbK0bivPM5JVmAbE+Ygdd/nNnkYpqGCmdjYFb7bX8veIE/AnoRJhkGpRFf1KqFJ19Qms PQkg5iN7UHcqevTaJZ6S68/yrhivxTyVPA2rRIuUGR/LzBGheSAF6XZrYl2JvV+HWW4u Qd2A== 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=I1w2fTWFH6D5/xRWuf1sz/hQSAip5UyfHVE49QGVzkg=; b=qGpztErC0xD1kB6CwjyatrcHv9epuv8sV9mTcAIuexTPQf7q0k/jOpayBHHpU5uija lw6uqCB9ljw/1NCHLCxJf82XSHUt5sd5ZEdBOUUWje/gLkafbdsnB1+UCLrZ3ke4N4WX lhL2QX3jJX8CmPmTaKmKBlb9wBjfgLbpVhdrzDg9CxRJTRzavIAYVqxfpVDdIQ8mtWrs SztD1MsuI0G9Gf5uV04gbjgi/i79rAKfFVSGuZh+RYoFE+UcUbvmD0WEw4jLF6Dksf81 Tk+NFW/V0xQaQ7ACkwjon/OXoXOu+El/PZJbRIBhCNZJ9UgsuBwZQiyM/q8cPHlpKhZw tjrA== X-Gm-Message-State: AOUpUlE25wd7A0JO0wfcaPDmQN1XRZL/t7+zKZLRNc3AAjWVZLJfsh0H /+Sw7UKybEwSffvnikv1FKIa0AB/ X-Received: by 2002:a17:902:3124:: with SMTP id w33-v6mr4262796plb.235.1532660831484; Thu, 26 Jul 2018 20:07:11 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:6c14:7712:e625:1be4]) by smtp.gmail.com with ESMTPSA id e9-v6sm3543503pgu.5.2018.07.26.20.07.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 20:07:11 -0700 (PDT) From: Jia-Ju Bai To: awalls@md.metrocast.net, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] media: pci: cobalt: Replace GFP_ATOMIC with GFP_KERNEL in cobalt_probe() Date: Fri, 27 Jul 2018 11:07:04 +0800 Message-Id: <20180727030704.2784-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 cobalt_probe() is never called in atomic context. It calls kzalloc() 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/media/pci/cobalt/cobalt-driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c index c8b1a6206c65..4885e833c052 100644 --- a/drivers/media/pci/cobalt/cobalt-driver.c +++ b/drivers/media/pci/cobalt/cobalt-driver.c @@ -670,7 +670,7 @@ static int cobalt_probe(struct pci_dev *pci_dev, /* FIXME - module parameter arrays constrain max instances */ i = atomic_inc_return(&cobalt_instance) - 1; - cobalt = kzalloc(sizeof(struct cobalt), GFP_ATOMIC); + cobalt = kzalloc(sizeof(struct cobalt), GFP_KERNEL); if (cobalt == NULL) return -ENOMEM; cobalt->pci_dev = pci_dev; -- 2.17.0