From patchwork Fri Jul 27 02:17:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 10546567 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D6C1174A for ; Fri, 27 Jul 2018 02:17:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84A092BA31 for ; Fri, 27 Jul 2018 02:17:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78E782BA3A; Fri, 27 Jul 2018 02:17:34 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 293672BA31 for ; Fri, 27 Jul 2018 02:17:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732094AbeG0DhG (ORCPT ); Thu, 26 Jul 2018 23:37:06 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42328 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732045AbeG0DhF (ORCPT ); Thu, 26 Jul 2018 23:37:05 -0400 Received: by mail-pg1-f193.google.com with SMTP id y4-v6so2285985pgp.9; Thu, 26 Jul 2018 19:17:32 -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=G8y7N9RH4AZkGuy8f62RMTy9APWhxwa4QK5qc88GqXI=; b=L5V5RNf5sSBsbQCk1PgyDjBJUfjGqGSIuvrwIOoI/1t+jw66a5B78CufrTekxOL9tW S0Uprpd6FZZdrU+p4mUPyvwbbZ98t8dRSQLfJ+Br0Dt8oxEMbETW/A4jx4QL/nR9YpNm 1ofb45mEwqPxVzhmX+Vhj3C9aSjVhGOGB3zAVdtA6LX7xtuyphciiNQu2H8Z5p9n1A0S 9qoLTLK53iYtnd4FzfGby7dL4mNGLB9KFhBPK/PY77glgo7yVc7bixZN21jX1SbfBWPH I8bq6ad9TkI7kgwJ39L5kWa+2qhlgNhpvfbPtc+nuF5jAh5yNMFit3xGTCURVnQp5/Lb +66w== 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=G8y7N9RH4AZkGuy8f62RMTy9APWhxwa4QK5qc88GqXI=; b=G5LlAUg6qoA3RU6MUiAPZSluq8VNPSJOb/EaOsoApufMSgar1NQuY0LkodUF8u9fhH c2s7lROSofgSH4G/nvvQ1g8eexwEBRu+7A1rj991TH9/0qo1V53eYGTTtq7QmHbr4b+A sdZWJTpzhILtSAGCa+qu145eP0Un2ItE80PDpp3zAEIb+cwqgr7Lh3zuI0Ppk7vRKeCR iKxh6OIMfVJpnEluCK+6nGazA8/3RhgCNSrDN/fbDZO63zioNhsV+NSjZjPTFn37JM2Q xpJCA7GC7lGmifCb1RKJVRvFhZqsSqZQXsL41HAiGHHEpnLr5bkJTYzegpevsH8v4MZc UMwA== X-Gm-Message-State: AOUpUlFBNOzGcdsQI+KuhtVLF47KGXuZGSNVvkuz6iErdHUYZ05tpUXo 76zJBeUhjBTJvbrVhv9kPWw= X-Google-Smtp-Source: AAOMgpeluSlSXdfteri0oN9jHZUS6F8SLSvLntvPQ8mgEEF6n+XG49KSuVyqOChNqvNe9rffP6uL7Q== X-Received: by 2002:a63:8b44:: with SMTP id j65-v6mr4224804pge.248.1532657852447; Thu, 26 Jul 2018 19:17:32 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:6c14:7712:e625:1be4]) by smtp.gmail.com with ESMTPSA id y3-v6sm3364502pge.29.2018.07.26.19.17.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 19:17:32 -0700 (PDT) From: Jia-Ju Bai To: dmitry.torokhov@gmail.com, arvind.yadav.cs@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] input: misc: powermate: Replace GFP_ATOMIC with GFP_KERNEL in powermate_alloc_buffers() Date: Fri, 27 Jul 2018 10:17:23 +0800 Message-Id: <20180727021723.709-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP powermate_alloc_buffers() is never called in atomic context. It calls usb_alloc_coherent() 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/input/misc/powermate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c index 5c8c79623c87..e8de3aaf9f63 100644 --- a/drivers/input/misc/powermate.c +++ b/drivers/input/misc/powermate.c @@ -277,7 +277,7 @@ static int powermate_input_event(struct input_dev *dev, unsigned int type, unsig static int powermate_alloc_buffers(struct usb_device *udev, struct powermate_device *pm) { pm->data = usb_alloc_coherent(udev, POWERMATE_PAYLOAD_SIZE_MAX, - GFP_ATOMIC, &pm->data_dma); + GFP_KERNEL, &pm->data_dma); if (!pm->data) return -1;