Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp312418imm; Thu, 26 Jul 2018 19:54:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeKrO2vVzf/otMG3aTz1ZoQz7FKJ0AoMlJSzolpll5HmBkljlBFd83D8Bz2+CDJlcdAJ1io X-Received: by 2002:a17:902:8f93:: with SMTP id z19-v6mr4168881plo.241.1532660040199; Thu, 26 Jul 2018 19:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532660040; cv=none; d=google.com; s=arc-20160816; b=jgsEfobrPUgKwLUX6nNeeJteRlCJoKjQuEjELdDiRb7Iei74Apx31sZ9fO5MmB2hJS 0IKTnlahIBYSDR+g/xs8g1X+XH8eP8wD/RAfRC3nok2ugWsWEyWPW8uStcEYQBUg1QLL eS4zs344rmH5YdcP5qZlWD4KdLOfbbHtW73nIqqTmaVj3qhwQ0RYl8CoYnXg/XaMbU9J awlZLmxGena1L+FqM+VU6n/A0sKwKgNZgPNN8BmmnJkkeRdV6HQ4RFFiD/59j3hOeIBB JwkI7vQQfmD0/P4qNkUrM/NERNmDM/U8+Ga5NYRkLfkQ7ELFGEo9rIkdzTWyhk5PX2o7 0lNA== 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=91B6a86QVGszavNjsra5ZaWT6Vl1493aO3Bd4/ZdI8E=; b=1CPgBBxJk0hENSA4aSluIc7g0qR8Gb1UikwyFb2iH8ZTIsfYofCG7iTFgX6TWliqlk y53tlmvmtKrEifGIlYjdUyrXTQMI9XBSG/cXtrwEsdifs1+kqLqbaRK3hEWIXJWegrpl 7E36xQ4aBqy+8SUladXg4InTBZFxF4tnuUQRf/7Nq4gZ70/mRebgK4k029WFrSg9Xfp+ 4u635wbY41tVWVDQ1NTr1SgpqMKZxyO4qnSd102rb4CtUgKiHc9FdTfT9URkW1MRxX9p l7yZBpuNym4Wzq6b3Tpe9EG1MjkEH8x7K4oHeONGFkGM/31U/hAbIfeTFf7g0oRluGRb VPRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EiJR9uBt; 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 t8-v6si2384828plo.77.2018.07.26.19.53.45; Thu, 26 Jul 2018 19:54:00 -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=EiJR9uBt; 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 S1726219AbeG0EMh (ORCPT + 99 others); Fri, 27 Jul 2018 00:12:37 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:35232 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbeG0EMg (ORCPT ); Fri, 27 Jul 2018 00:12:36 -0400 Received: by mail-pl0-f68.google.com with SMTP id w3-v6so1672134plq.2; Thu, 26 Jul 2018 19:52:56 -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=91B6a86QVGszavNjsra5ZaWT6Vl1493aO3Bd4/ZdI8E=; b=EiJR9uBt0gOpqcFZLPnQsz0QVMkSDG9wg0iAoHmap5x/R5j4Qxrn5uKVKTwb3AzDgu pZVRl5m6DpQ3Rj00PfdrtZhqbTdrnlJ/7fSGV7ugzwilMwhBkv8TMrQUNyamvqNaTWfn k7734z45xy7VHQsBFa5d0oGJnTs+zMes7jvsgz5Vu/xc8x7cqXTBc3XXZXMulWJlMw3R owycV+1iIViSeB0U2veo04j5PuvLeqGz0mixsb8bvKsqA5A5X82flS8PFCt3QW2/vEsw XQ3Z+rYMoKrCk2zGb3ip3F0bzCiTOH86vO/qPN2GStBsTCme5T+hdo6cGZa1SkWiw2oZ iG+g== 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=91B6a86QVGszavNjsra5ZaWT6Vl1493aO3Bd4/ZdI8E=; b=FxV8V8BIyKdvSF0uHGfRRA9+lEjo3OFxHzShC1lxjNMFoEHRr7kM/499+XZPzmyw1n YCxfJpCl3y3+lAd447LUdAeJDei4uNigXQScTW88izKiYwlizuv2Nq9wNT1lBzPIoXLs 6aOGjWP0HPzd9y9YiB9iFF5GwnPxDvejtRWQ1izCDg7cdVSatYc7p4y5IV6xv5WiveBD 0bSGbGR6BRX0vc6kSgB4ycfV6wOhou0Cs4PEcJFYBBFd2XKVlqy3JofUazrUfc6ZLoV3 ZYgHznBpw6OXcj/3O2e/cealkEqeYYutOcHpv72fjvmbigtFQYFVWsb/J7W4wXh7TR8Q 0FUQ== X-Gm-Message-State: AOUpUlGXUw65rFHJDhTaiMlpy/CSL4zB2SZe6az6CoUfE/NiW8WTy23Z Pou68WSRD1TzqKw6hPDuBsw= X-Received: by 2002:a17:902:a5:: with SMTP id a34-v6mr4367094pla.60.1532659976583; Thu, 26 Jul 2018 19:52:56 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:6c14:7712:e625:1be4]) by smtp.gmail.com with ESMTPSA id f18-v6sm8701675pff.29.2018.07.26.19.52.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 19:52:56 -0700 (PDT) From: Jia-Ju Bai To: crope@iki.fi, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] media: dvb-frontends: rtl2832_sdr: Replace GFP_ATOMIC with GFP_KERNEL Date: Fri, 27 Jul 2018 10:52:49 +0800 Message-Id: <20180727025249.2249-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 rtl2832_sdr_submit_urbs(), rtl2832_sdr_alloc_stream_bufs(), and rtl2832_sdr_alloc_urbs() are never called in atomic context. They call usb_submit_urb(), usb_alloc_coherent() and usb_alloc_urb() 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/dvb-frontends/rtl2832_sdr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c index c6e78d870ccd..d448d9d4879c 100644 --- a/drivers/media/dvb-frontends/rtl2832_sdr.c +++ b/drivers/media/dvb-frontends/rtl2832_sdr.c @@ -301,7 +301,7 @@ static int rtl2832_sdr_submit_urbs(struct rtl2832_sdr_dev *dev) for (i = 0; i < dev->urbs_initialized; i++) { dev_dbg(&pdev->dev, "submit urb=%d\n", i); - ret = usb_submit_urb(dev->urb_list[i], GFP_ATOMIC); + ret = usb_submit_urb(dev->urb_list[i], GFP_KERNEL); if (ret) { dev_err(&pdev->dev, "Could not submit urb no. %d - get them all back\n", @@ -345,7 +345,7 @@ static int rtl2832_sdr_alloc_stream_bufs(struct rtl2832_sdr_dev *dev) for (dev->buf_num = 0; dev->buf_num < MAX_BULK_BUFS; dev->buf_num++) { dev->buf_list[dev->buf_num] = usb_alloc_coherent(dev->udev, - BULK_BUFFER_SIZE, GFP_ATOMIC, + BULK_BUFFER_SIZE, GFP_KERNEL, &dev->dma_addr[dev->buf_num]); if (!dev->buf_list[dev->buf_num]) { dev_dbg(&pdev->dev, "alloc buf=%d failed\n", @@ -390,7 +390,7 @@ static int rtl2832_sdr_alloc_urbs(struct rtl2832_sdr_dev *dev) /* allocate the URBs */ for (i = 0; i < MAX_BULK_BUFS; i++) { dev_dbg(&pdev->dev, "alloc urb=%d\n", i); - dev->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC); + dev->urb_list[i] = usb_alloc_urb(0, GFP_KERNEL); if (!dev->urb_list[i]) { for (j = 0; j < i; j++) usb_free_urb(dev->urb_list[j]); -- 2.17.0