Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3732964imm; Mon, 30 Jul 2018 02:25:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpekfn33YZyEU2QjDMp6AgYG2AdUrsUKRJ1ykxImT9q/QXwOCZE0Sp+RuAn+xHfwTA/yb3+M X-Received: by 2002:a17:902:7481:: with SMTP id h1-v6mr16134604pll.183.1532942754671; Mon, 30 Jul 2018 02:25:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532942754; cv=none; d=google.com; s=arc-20160816; b=dUG44XgaapJsQ67ebRZMX70J74XZWGKaGCIAc698gfW3HYS4Dvz3DYD3UhencelU4i /t9OhqScsaL3IfTzL6tNdswTtAqsujoSKUbA35YkYhJm9sW1rSSmr+ETk4w1d7nHmQWW UAJT/vhT97JWrTTlEnp62jMIM+0Xj+WXlrRYUElgLmHKP00B6xVCR1xoiM5m77uTgBYA p0HNPySPQ6m1Gqcu+EFzkHxG6kzjiOBFFPdaqFHcWmst7uxKMImWM1nJASCsYByhCz8/ QixbG/mwIvwyXv6BWCppgIom6XDzov0qZScwZ7saUvEW1jTa+5k74hoUMX1n7MioaWO0 2yKg== 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=uQ9newEHcGdTfHYxexpgeCSpanVtUOSJPKQQb8/8RxI=; b=KylgHmwl9A4huwCu42yLD7oyhKttSydgJnvkeTKABFewE70F8hIl/bbsm8OtAtu+pk lwCJ83UgnEkHKzo2XB2da8pXMVPuzB5uR/x2A12bBYu4WUF/IgxVfycO7uj2NYuzYN6g +goCz8hKXR98RhWjpayCMX2b5WoBfinsqVMF48dCGlXE3r9sKmfRnUqXg7SGbQbDxBlf THjppUNeakmG6CPHLBi1lJP9MtIecUMgule2ydGrSFRHEGI/7o3RUffTNS7Yg7ksIL1u h/0GRNCpoLIGyiEHQzCKmPM/1/cHMvqwUP//z7aS/7J8BnDu2HlvNSmsHDK11Jq4amOt 0BBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TDvD11fA; 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 b13-v6si10163770pgh.255.2018.07.30.02.25.40; Mon, 30 Jul 2018 02:25:54 -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=TDvD11fA; 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 S1727213AbeG3K6P (ORCPT + 99 others); Mon, 30 Jul 2018 06:58:15 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40742 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726703AbeG3K6P (ORCPT ); Mon, 30 Jul 2018 06:58:15 -0400 Received: by mail-pf1-f193.google.com with SMTP id e13-v6so4267177pff.7; Mon, 30 Jul 2018 02:24:10 -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=uQ9newEHcGdTfHYxexpgeCSpanVtUOSJPKQQb8/8RxI=; b=TDvD11fAdkYX25xKpHUvSKegyTcjKPLjd9GWx5BxusjEeciaRLkfAOh2xe4QZtfSqC 8hmww5CQI8/mZx66bmRNCjpg9MbLbsfNhdQse8q7U8rVsOxL6Hi+FQvhgeYOtY8zMO3o ogk5DYRIvemXccb8+rCqzHXcD4fdNmSYeeO6itysaQQjBcKzlUFnvUPLlHJnVJOXmRJ8 /q/cJJIqSs83wQCMYHY/BXc3tftN296YzTdRO/vtQZAQ7vWDy/mNj70ChdWRSe6G9VUJ ioeB6w6X69kfatxVIaxO/+AnpbTHqTIDrI6huThoP4CBEf6fHdra2FukfIwaeLw+0EPP sj1w== 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=uQ9newEHcGdTfHYxexpgeCSpanVtUOSJPKQQb8/8RxI=; b=CfNJXgC22rPLCnFQ8I17mg7C91lqD2q2JqfyLehqZ0pfoWTQiMzIpM6ddlwMD/9VLe Vs1fM7t6Kt2W6NcrnlvdpEEN55nVA1vhGjyc6fpRnmQ6575pO8yZk5L9SU/4kp5lgzrw XM3YOiFKC0ncPCL5Qm9MsZprqmDlyDEk9vh9ojMJuXXWfnOq8GaCr/5Sbrx7sckYNJhJ GZqz5iiVsQSlrvKvlaGQIzpUoHEIiatInPmdHJWP5pUS10m1yGTb/vfR2WA5raY7ndcc 3GPCYCPnlMbrIcWi7ED+t32lvjObMC+MMhNR0Z1EfMz+6NyYSkBal1v/XJf1wECK1Wkg zx+A== X-Gm-Message-State: AOUpUlGPwFSt+sXy5T87skcUljtHFejxsZYzF/+FZhFf06OIBWW8ZbL4 63DZhj7BftzWxOkOmDpTMDM= X-Received: by 2002:a62:1157:: with SMTP id z84-v6mr17257532pfi.66.1532942649791; Mon, 30 Jul 2018 02:24:09 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:4550:ab75:cee3:d6c1]) by smtp.gmail.com with ESMTPSA id j1-v6sm29092327pfk.125.2018.07.30.02.24.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 02:24:09 -0700 (PDT) From: Jia-Ju Bai To: mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 1/3] media: usb: em28xx: Replace GFP_ATOMIC with GFP_KERNEL in em28xx_audio_urb_init() Date: Mon, 30 Jul 2018 17:23:52 +0800 Message-Id: <20180730092352.7775-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 em28xx_audio_urb_init() is never called in atomic context. It calls kcalloc(), usb_alloc_urb() and 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/media/usb/em28xx/em28xx-audio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c index 8e799ae1df69..bb510cf8fbbb 100644 --- a/drivers/media/usb/em28xx/em28xx-audio.c +++ b/drivers/media/usb/em28xx/em28xx-audio.c @@ -842,11 +842,11 @@ static int em28xx_audio_urb_init(struct em28xx *dev) dev->adev.transfer_buffer = kcalloc(num_urb, sizeof(*dev->adev.transfer_buffer), - GFP_ATOMIC); + GFP_KERNEL); if (!dev->adev.transfer_buffer) return -ENOMEM; - dev->adev.urb = kcalloc(num_urb, sizeof(*dev->adev.urb), GFP_ATOMIC); + dev->adev.urb = kcalloc(num_urb, sizeof(*dev->adev.urb), GFP_KERNEL); if (!dev->adev.urb) { kfree(dev->adev.transfer_buffer); return -ENOMEM; @@ -859,14 +859,14 @@ static int em28xx_audio_urb_init(struct em28xx *dev) int j, k; void *buf; - urb = usb_alloc_urb(npackets, GFP_ATOMIC); + urb = usb_alloc_urb(npackets, GFP_KERNEL); if (!urb) { em28xx_audio_free_urb(dev); return -ENOMEM; } dev->adev.urb[i] = urb; - buf = usb_alloc_coherent(udev, npackets * ep_size, GFP_ATOMIC, + buf = usb_alloc_coherent(udev, npackets * ep_size, GFP_KERNEL, &urb->transfer_dma); if (!buf) { dev_err(&dev->intf->dev, -- 2.17.0