Received: by 10.223.176.46 with SMTP id f43csp418064wra; Fri, 26 Jan 2018 00:45:17 -0800 (PST) X-Google-Smtp-Source: AH8x225VXtiZBEHyAyW8TdQSOl0G43vxUajiAozW+ZgvTjXr1srEC+rk+IAAwMUPjaecSbjtvxkz X-Received: by 10.98.217.28 with SMTP id s28mr18562403pfg.69.1516956317842; Fri, 26 Jan 2018 00:45:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516956317; cv=none; d=google.com; s=arc-20160816; b=odhnIGyWvxDcLhFTGUx4oeSBxeLZulFtGkSaV0NSMupudNwt6UCeZnq1MoyHne6mPC mnl6hUvO2I+l5SaiqNJIfFC7Z6ep2m1WHYbNl1g6LVdNXpGIb/IPFzVfQOXvXeicZGeh 7N2UcuG42l9QDU9nSx4X5nnR22QrlWNa5nTr8IZPk0emUozpMtWy4H2rq3QAZ6rhTGcO wKNIKbkn2jkm023i+pWkj4Eo8BD29fj1c8KZ76IcESCIcxsGdU0ePxnL/SIr45Wydl4d VnVbH14Ifk+BAXpsG7fHdZlTHYyMceVGdWwCBr1u8GGZq2X6KeRx+mHqdRx7aUq9D3M3 iGrQ== 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=9UqO9+scgShf64/CCMyt2J44ubsX87xnBQaK67lAGcA=; b=FW5Rpv7trLdOb+cTMZTaSRbuVm6Gz6kU1c0VAC2UqOXfXfE8RViGKdi4AZfYXuXnan pbO+8hyZDytrSSrUB3kzQIExq8aqm7XbK2TwFQGfbw6Q3H3sX70KJ+KS8R7pDNePxj/x Hq8VUG9YvYwrkbr+qeCdb1uNHKEH6S7msO6IZqqt7ryv69Sc2fsgDHh2e7GzetEZ5gst pCAzI1SPRwwUjvULwIEv7hL2J9dTD9Urlw/47Oq5bqBPfYmNcRgV5fw7mDJ4IGfnKbPl Kzn3bpVRcUyVXgBHlZXQOZQuhcKw2mboeaERKB2FVd8eoO06rZ4hya7lbmFp0TaSoHzG 9lrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Piy8pOam; 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=NONE 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 e8si2737822pgr.63.2018.01.26.00.45.03; Fri, 26 Jan 2018 00:45:17 -0800 (PST) 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=Piy8pOam; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752557AbeAZIoV (ORCPT + 99 others); Fri, 26 Jan 2018 03:44:21 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:38947 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752336AbeAZIoT (ORCPT ); Fri, 26 Jan 2018 03:44:19 -0500 Received: by mail-pg0-f67.google.com with SMTP id w17so6858732pgv.6; Fri, 26 Jan 2018 00:44:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9UqO9+scgShf64/CCMyt2J44ubsX87xnBQaK67lAGcA=; b=Piy8pOamzaJ4qFYYUG0hJYcwe2pC+f89xkxAeFXau/S11md7KoeKx7Z5pE5eQKSXVq 88AmCSVO7FRSTockXzen0Vn8jr0Mo8nr0qV+wxJlVRuKelvrlzK9IcCANdMYR32UwXvu MBRjA9bwRnP+8U/61yZt3HV7H7daL6WJIDFq4OXgfkxnEdEj16/HLelEIeclRxooecPQ FVwz8HGPmVqUAjR0SVtBk/eY4qXAfrchi/j41ylN6SqvCBRs5wPnhTsEqFe35GTIjguG cbMEkG0Gpqom10BfVFCFW92PHz21dq+CRdroqevdEmSBuUzfCMxbpmr3L5wlxv7ugHd0 TvBQ== 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=9UqO9+scgShf64/CCMyt2J44ubsX87xnBQaK67lAGcA=; b=g3IGvLCAipuBK86YD/X7XPrEYRUCcmtERxAR0PmpxE7wgsjR2hAehigl7vArbZfVO7 +s/YcPO/TvqyOGSoGPghPA3IqeRztvzqrcLkOq999q99bWNsurFoJCqUF6GMDQdjdsoS hKBCE1Z9ycy7q8RBCd6ZacaRFdKFhYURYOL4F6Y7s7sWHgheeMT0XoY/47ajBpH3Htpz BDDVxZUE1uCRoCkg4qm2J4kYSNK3eWseOzOPKn5GHkPU5VGsTVepxPHtXD2e0L3qt+wR HoeOziEPWblplm5J5nfRUHS0m8/TffQTS3sm4a6jwpNcvLDuDy/+N+fvT4sHT+IOoWVx FSqQ== X-Gm-Message-State: AKwxytcRTsGk1K+VjgarDPXH8oNVPREx8CNs6flJBfw8LsnT6y45zGgK VZ9mrkOxNQtrezv6WZUpKKQ= X-Received: by 2002:a17:902:46:: with SMTP id 64-v6mr13967829pla.341.1516956259036; Fri, 26 Jan 2018 00:44:19 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:3967:a579:e81d:66fa]) by smtp.gmail.com with ESMTPSA id e3sm18144908pfb.143.2018.01.26.00.44.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 00:44:18 -0800 (PST) From: Jia-Ju Bai To: vireshk@kernel.org, nm@ti.com, sboyd@codeaurora.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] opp: cpu: Replace GFP_ATOMIC with GFP_KERNEL in dev_pm_opp_init_cpufreq_table Date: Fri, 26 Jan 2018 16:48:49 +0800 Message-Id: <1516956529-32264-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After checking all possible call chains to dev_pm_opp_init_cpufreq_table() here, my tool finds that this function is never called in atomic context, namely never in an interrupt handler or holding a spinlock. And dev_pm_opp_init_cpufreq_table() calls dev_pm_opp_get_opp_count(), which calls mutex_lock that can sleep. It indicates that atmtcp_v_send() can call functions which may sleep. Thus GFP_ATOMIC is not necessary, and it 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/opp/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/opp/cpu.c b/drivers/opp/cpu.c index 2d87bc1..0c09107 100644 --- a/drivers/opp/cpu.c +++ b/drivers/opp/cpu.c @@ -55,7 +55,7 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, if (max_opps <= 0) return max_opps ? max_opps : -ENODATA; - freq_table = kcalloc((max_opps + 1), sizeof(*freq_table), GFP_ATOMIC); + freq_table = kcalloc((max_opps + 1), sizeof(*freq_table), GFP_KERNEL); if (!freq_table) return -ENOMEM; -- 1.7.9.5