Received: by 10.192.165.156 with SMTP id m28csp216928imm; Tue, 10 Apr 2018 20:11:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+V9Eeyjp3LZXDTLmQGk0jYmS723A4O8YZakQQsR5QT+r493IWVtUqUBoDvDbo0/751Ehhv X-Received: by 2002:a17:902:6acc:: with SMTP id i12-v6mr3131112plt.353.1523416261961; Tue, 10 Apr 2018 20:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523416261; cv=none; d=google.com; s=arc-20160816; b=ULI9ykwvSDRhFG5jrwGJmGJ2tjAKK/mJCS8/Q+XxOkM4VgJBOwj7mopVgPh5xX88jw RZMT9CB5Z4uMKaREhUkKcJ77D4tqQ6q3+Kv1tBSDbe6DpB/6TN+m0NtccNdu5MaqsCMq Zu4NE3XIBuAPIsnLkGjQpkdCHCGE45UfgugymJyNGnI5RRqveLxpL3O1fhUZtrk7H/T/ NgOlN+hcHidoc+xIP3xCDMyiss0x8MYvJMqjsvIeYJEXWNmjCWFsfsk3F9orfZBzRr/3 27IJjLRiT4nVfHlJ1iEeT/kXKA1q4XTK77yvLa+e4aF+wDi+BF8U8/NBJs1dyOw3RQAG X3Tw== 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=wxnf4jRzKtOOd6mszvOFEeF0RMAKDQI5frBAkD+l+kw=; b=lC9XSSEk2pORi3Y962ty8e72YxBi3oYs6uXGwyPgpUYk0yIgcqiIW0E1aHv08AJGRp qrTqQHoWCjvVZQqB2NADL8JomI/aCO7hIMEY+WH6JtgPIF1WjL7yB8ioj/4wa6AgM0Yp gi3kow5/yBBWeZr5xIF5e8E1Nfypio78tsVW9sPou1O16EyMAWuUviqAhpd1ElSfn0+U Xr1xoKG6L0ZQM3JVxcIEAHivl3aJEcw1SzrKbKhivCrM1+QU1AGoWdet6k5CqqAyg5qH 6LX8HyPPUzZnalr+I93W6/OBJdATAqhBBLYkQqDVA/G1w4/o0cSHgAQrAU7Xu66LlOxA C0/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P4U7QRLv; 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 s12si69780pgq.766.2018.04.10.20.10.23; Tue, 10 Apr 2018 20:11:01 -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=P4U7QRLv; 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 S1752474AbeDKDHm (ORCPT + 99 others); Tue, 10 Apr 2018 23:07:42 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33255 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751624AbeDKDHl (ORCPT ); Tue, 10 Apr 2018 23:07:41 -0400 Received: by mail-pf0-f193.google.com with SMTP id f15so261294pfn.0 for ; Tue, 10 Apr 2018 20:07:40 -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=wxnf4jRzKtOOd6mszvOFEeF0RMAKDQI5frBAkD+l+kw=; b=P4U7QRLvf1GgdoUL4lnl7GGoAQIImQPh4DYMoSCV93oBT70Zu/7hrpRNEOB5elRXJt pEBpxrfcZEIaZZxuaZPXV1E/n1XAyBuWZ+zHAwKX9+dRuvrUT7rfiaL30JtqTNWm/ebs U1ybP3WBM1wgJijTz83y7/+ZiS8vKNLY+lu702QdOGaboMufPzz3IP23gK7iF8St8gaI Ct+2ssDaiJQOOfjZ72oXjwlmvfj2FbCKlRJBQ6YvOpHpCrN/EZHY41Yl3y4GIpXLmxpJ Fq8zqqrYctLFvS5oq4YGQn+EnXWz/6mSepRsTRlKbqjI8pJ7Qu6e8392or3AwdxNEnWU QLWw== 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=wxnf4jRzKtOOd6mszvOFEeF0RMAKDQI5frBAkD+l+kw=; b=dF8PASAi3mc9NqFPZB8m14xuOH1b1f8wF/134SEVeYim8fYAfNrvl9NszVH+s8Ec12 T8CVGaR7sy6NtkMt0IwuLP90zn6AlNL16j8eTSBqL6q13btqCEsX/9aVuryenr877j4/ vLtV+i4vXArhw4GEQ9A3gnkLmD8ZXOm85hYzG55XQGKBAcIsjn4ii27mciG0ACslliEh 1CdhaOWNNWrN9m0rXn7hGrVrzy9RzRd9cOl71Dj2ngoG5aLtZF+jLN0pbZkuwTAY9atz Vx/FLlZ/zEE5WTDUmcemt2rDPi2dLHGCgZIMGiM1lNoKG7IQoylFeRH5ezvMUdoFKUGa bp4g== X-Gm-Message-State: ALQs6tD2CjOmVaMyjPDB0kj/PXjQ/FzvhKn9InPohJrJL4ui/q37N/nn FGMzmgJXRMn8tylPRu00bsk= X-Received: by 10.99.143.30 with SMTP id n30mr2140248pgd.213.1523416060583; Tue, 10 Apr 2018 20:07:40 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id w134sm236043pfd.132.2018.04.10.20.07.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 20:07:40 -0700 (PDT) From: Jia-Ju Bai To: arvind.yadav.cs@gmail.com, johannes.berg@intel.com, stephen@networkplumber.org, davem@davemloft.net, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] misc: ti-st: Replace GFP_ATOMIC with GFP_KERNEL in kim_probe Date: Wed, 11 Apr 2018 11:07:32 +0800 Message-Id: <1523416052-2938-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kim_probe() is never called in atomic context. This function is only set as ".probe" in struct platform_driver. Despite never getting called from atomic context, kim_probe() calls kzalloc() with GFP_ATOMIC, which does not sleep for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/misc/ti-st/st_kim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index b77aaca..5ec3f5a 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c @@ -735,7 +735,7 @@ static int kim_probe(struct platform_device *pdev) st_kim_devices[0] = pdev; } - kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC); + kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_KERNEL); if (!kim_gdata) { pr_err("no mem to allocate"); return -ENOMEM; -- 1.9.1