From patchwork Wed Apr 11 02:14:10 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: 10334761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1E8326053F for ; Wed, 11 Apr 2018 02:14:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 079EF2870B for ; Wed, 11 Apr 2018 02:14:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 021512871C; Wed, 11 Apr 2018 02:14:19 +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 F10CF28744 for ; Wed, 11 Apr 2018 02:14:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752322AbeDKCOS (ORCPT ); Tue, 10 Apr 2018 22:14:18 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:36035 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752172AbeDKCOR (ORCPT ); Tue, 10 Apr 2018 22:14:17 -0400 Received: by mail-pl0-f67.google.com with SMTP id 91-v6so234259pld.3; Tue, 10 Apr 2018 19:14:17 -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=xo9jtb++bu9JDOaK0PG+EHdeWEoMilnV4XsJZ53nybU=; b=vYbFQOnbOHasOcn6PVOO2343nW9zJ4DquYUHeryx9MeLQoTr2Rz04FZ/6V4JvyAaBP dujPDveU0PgbuaHdQjxlUPvi2EfdPg/sIwbfiaztpC3LLF6J/YI0YrkaiBGJfik2RMT9 VMkpE8mfDEsReoVgpW/qOvI8b7KGiw8+ztVDEQMvC3gTHlGI564RwqpQRJ7GaHj4koMU cFen4h13KRQEJ1OvkBd3XSxC8kOj+z2lFEbfuA/v6Krr0OFyX/J0c74UcH8irgVE7ccU QJjLuKEpGNEFoQXG4jySYYtQhU5e9Mtjplu0CGYZ2qHxx1ODHOWTkzZAw6vCXz1iyT+8 QYgw== 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=xo9jtb++bu9JDOaK0PG+EHdeWEoMilnV4XsJZ53nybU=; b=MoQ6LTknssprWVnmVtmqtL69dBjY9si0k8hk58tnmFDCAocBwGNdxAdRcbmD64J6yC bEhKwpXwa6F/63MHj1UcFWBJOUi79GJs5fYPuNlnyl64WrOtHxNdtqK5zJiePYNZVo/e PpzeynaFvWyva68qcTGwrVmVOZGuTodkLJBuPPARcqMfSbc3PkRm2qEbm4qChvh1P2dM mHw9hggPx9X1yufcLb80Ad2UaqEEjX1TilMBwUdz/cqrAF/sIh3ECg+Am9Q0v+qoraBA iP7RrhnHRHEVyF0c8Xhuv4BRll2z38tlhA/EBI2TSe9ZI6Y0J2ILzEruuE8Ca/EPpPcX wU3Q== X-Gm-Message-State: ALQs6tBcXcW1+qdYBFp8aSdM5IZBkZjr8vNI+boOnzskAoxMc7zYB7WJ BlTUTV/hCFVlI93mozu+1nU= X-Google-Smtp-Source: AIpwx4/RO2oGsj6muOFwt+IZJD2PpWnASRl86lkkzPupXWWaEesXk42HiyGG/B8tO2qpSk7kyYNejg== X-Received: by 2002:a17:902:b187:: with SMTP id s7-v6mr2951599plr.170.1523412856855; Tue, 10 Apr 2018 19:14:16 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id b184sm109180pfg.110.2018.04.10.19.14.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 19:14:16 -0700 (PDT) From: Jia-Ju Bai To: stefan@osg.samsung.com, alex.aring@gmail.com Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: ieee802154: atusb: Replace GFP_ATOMIC with GFP_KERNEL in atusb_probe Date: Wed, 11 Apr 2018 10:14:10 +0800 Message-Id: <1523412850-2260-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP atusb_probe() is never called in atomic context. This function is only set as ".probe" in struct usb_driver. Despite never getting called from atomic context, atusb_probe() calls usb_alloc_urb() 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/net/ieee802154/atusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c index ef68851..ab6a505 100644 --- a/drivers/net/ieee802154/atusb.c +++ b/drivers/net/ieee802154/atusb.c @@ -789,7 +789,7 @@ static int atusb_probe(struct usb_interface *interface, atusb->tx_dr.bRequest = ATUSB_TX; atusb->tx_dr.wValue = cpu_to_le16(0); - atusb->tx_urb = usb_alloc_urb(0, GFP_ATOMIC); + atusb->tx_urb = usb_alloc_urb(0, GFP_KERNEL); if (!atusb->tx_urb) goto fail;