From patchwork Sun Sep 17 20:16:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9955059 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 5F4416028A for ; Sun, 17 Sep 2017 20:17:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5227928969 for ; Sun, 17 Sep 2017 20:17:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4512328970; Sun, 17 Sep 2017 20:17:55 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 6137B28A8D for ; Sun, 17 Sep 2017 20:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751848AbdIQURV (ORCPT ); Sun, 17 Sep 2017 16:17:21 -0400 Received: from mout.web.de ([212.227.17.11]:59728 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751352AbdIQURU (ORCPT ); Sun, 17 Sep 2017 16:17:20 -0400 Received: from [192.168.1.2] ([77.181.201.34]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MdLsF-1eAw231ghv-00IY6E; Sun, 17 Sep 2017 22:16:52 +0200 Subject: [PATCH 1/8] [media] cx231xx: Delete eight error messages for a failed memory allocation From: SF Markus Elfring To: linux-media@vger.kernel.org, Bhumika Goyal , Hans Verkuil , Johan Hovold , Julia Lawall , Matthias Schwarzott , Mauro Carvalho Chehab , Oleh Kravchenko , Peter Rosin , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Sun, 17 Sep 2017 22:16:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:7vf3ULHO02cSOD1jIhnXNAHPIav4Q75PtEIbsmIYekhfs36ZZmw fPCdFroRIJBC2p8NwDiRFVE+8KDujZHXB6urS5yf42L9I/gDsIBMLuoMd9A+8vuSvD6hWmM ddv12XRpzF6O8IiBNKyhyxREog0V3bAqb3S0P2LcoCYFw7mkgSOsxmSYaRkphL8uoitqPqZ N0MmM9e/JEfUoRKnbV8bQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:omo5TWA8ae0=:WJXsIyWp5F1KWeYDsaKsRw nkHRd/b6pfrhyCbYNUqqFsjEBRlgSuNzfZ2Y74ha3xbBzUatJZrNpUtUQxcj8FJ7TQKu09tgD EwBHF8QoTxf7BbYApCStVRvvf07U4KFii6Lee0UMBivkUmbq1PgxRf5R8CYpU/v2HzuTnfoQ1 t+VBLroTYgPXT4whqQHh+A6oXALBuCf+Tmeb9DY9XGMJVpdex5Cpkic1ZXXNqv6qutIieUYeV 4Ti+xIw2vtzeT4AcLFU4sDTQ+g2jEmkXN+CGCsdHlC68tosXHPGnvhDpEn5lRaa8+bkSE8WHM oLPpEsM13qiEQZAXz2GOoSa8nexEkjZOTUaOx0oI3URgUTW/Br7on21NmFEe2CQKHoe2VpZDg fC/GgzJjSC/lpR86TFnO+1nL2E7L4xXBPqUmQw7grHTLMa0MDgxwJ5FeIQBtplOZZ77hYR0z0 fkM+L83AaAbl4U2y5yElUJanGLpxnaT8L+kC4Lk4FcMGVQ6uJ1fZyruOJMuIboB393z7G4FDe dHu9oKXu5u0wbTB1tRC3qDqFKYFjTjQPQRpjAx0qoNoukLxZgyvjNEo8VINm1n+20B+z/nCgG 5OswSfi1tUtT5kWrVG4anwwsWadJkvoEdsCcsVAATYGKSZx8T44Wj6jqsG2mVDzO4h8AziXIj NeAUFLedmXk9kdcS+ZrZnYr++96wnP8mmig151lHUenyZ/6rPCLqO3GV0b5XBokKR2+/0ZkE6 P1YDlpV+tDa8qHJbf4Hjj2J8JViT7isbLJ2Q/VhupuEP/HzwW3CgQ4cGg+u/eM3v0FCxzE0w2 TL3gtY5A4cawwh2HIf1ZY4ulL+xVFjfqXvzv07yEtgLEwRby+0= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 17 Sep 2017 17:43:47 +0200 Omit extra messages for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/usb/cx231xx/cx231xx-core.c | 14 ++------------ drivers/media/usb/cx231xx/cx231xx-dvb.c | 7 ++----- drivers/media/usb/cx231xx/cx231xx-vbi.c | 11 +---------- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index f372ad3917a8..d9f4ae50e869 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -1038,12 +1038,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, - if (!dev->video_mode.isoc_ctl.urb) { - dev_err(dev->dev, - "cannot alloc memory for usb buffers\n"); + if (!dev->video_mode.isoc_ctl.urb) return -ENOMEM; - } dev->video_mode.isoc_ctl.transfer_buffer = kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); if (!dev->video_mode.isoc_ctl.transfer_buffer) { - dev_err(dev->dev, - "cannot allocate memory for usbtransfer\n"); kfree(dev->video_mode.isoc_ctl.urb); @@ -1173,12 +1168,7 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets, - if (!dev->video_mode.bulk_ctl.urb) { - dev_err(dev->dev, - "cannot alloc memory for usb buffers\n"); + if (!dev->video_mode.bulk_ctl.urb) return -ENOMEM; - } dev->video_mode.bulk_ctl.transfer_buffer = kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); if (!dev->video_mode.bulk_ctl.transfer_buffer) { - dev_err(dev->dev, - "cannot allocate memory for usbtransfer\n"); kfree(dev->video_mode.bulk_ctl.urb); diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index c18bb33e060e..248b62e2099c 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -618,9 +618,6 @@ static int dvb_init(struct cx231xx *dev) - - if (dvb == NULL) { - dev_info(dev->dev, - "cx231xx_dvb: memory allocation failed\n"); + if (!dvb) return -ENOMEM; - } + dev->dvb = dvb; dev->cx231xx_set_analog_freq = cx231xx_set_analog_freq; dev->cx231xx_reset_analog_tuner = cx231xx_reset_analog_tuner; diff --git a/drivers/media/usb/cx231xx/cx231xx-vbi.c b/drivers/media/usb/cx231xx/cx231xx-vbi.c index 76e901920f6f..9c27db16db2a 100644 --- a/drivers/media/usb/cx231xx/cx231xx-vbi.c +++ b/drivers/media/usb/cx231xx/cx231xx-vbi.c @@ -420,12 +420,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, - if (!dev->vbi_mode.bulk_ctl.urb) { - dev_err(dev->dev, - "cannot alloc memory for usb buffers\n"); + if (!dev->vbi_mode.bulk_ctl.urb) return -ENOMEM; - } dev->vbi_mode.bulk_ctl.transfer_buffer = kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); if (!dev->vbi_mode.bulk_ctl.transfer_buffer) { - dev_err(dev->dev, - "cannot allocate memory for usbtransfer\n"); kfree(dev->vbi_mode.bulk_ctl.urb); @@ -453,8 +448,4 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, if (!dev->vbi_mode.bulk_ctl.transfer_buffer[i]) { - dev_err(dev->dev, - "unable to allocate %i bytes for transfer buffer %i%s\n", - sb_size, i, - in_interrupt() ? " while in int" : ""); cx231xx_uninit_vbi_isoc(dev); return -ENOMEM; }