From patchwork Wed Sep 20 16:57:52 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: 9961863 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 18B5160234 for ; Wed, 20 Sep 2017 16:58:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0994D291B2 for ; Wed, 20 Sep 2017 16:58:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2840291B4; Wed, 20 Sep 2017 16:58:37 +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 AC97B291B2 for ; Wed, 20 Sep 2017 16:58:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751618AbdITQ6W (ORCPT ); Wed, 20 Sep 2017 12:58:22 -0400 Received: from mout.web.de ([212.227.15.4]:52451 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751551AbdITQ6R (ORCPT ); Wed, 20 Sep 2017 12:58:17 -0400 Received: from [192.168.1.2] ([77.181.108.184]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MAdX1-1e5Sli11bv-00Bv8V; Wed, 20 Sep 2017 18:58:05 +0200 Subject: [PATCH 1/5] [media] s2255drv: Delete three error messages for a failed memory allocation in s2255_probe() From: SF Markus Elfring To: linux-media@vger.kernel.org, Arvind Yadav , Bhumika Goyal , Laurent Pinchart , Mauro Carvalho Chehab , Mike Isely , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: <55718a41-d76f-36bf-7197-db92014dcd3c@users.sourceforge.net> Message-ID: <40736ede-e614-e498-8768-b8e5a1553f34@users.sourceforge.net> Date: Wed, 20 Sep 2017 18:57:52 +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: <55718a41-d76f-36bf-7197-db92014dcd3c@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:/ZwK+FURF2vAh7+ffFvxSC5igvwPAgpeVV6CB1QeXKIBhPt3yoF lSRzVKvdgpPmPRQFh0nPZzfb0Bbzpc0mzqZCI9oCcRWzFeqVthkQ6JeEmlmCh2ARdg71K6a EZnTn5wwSoV/Si9Pll0Ryow9LPMa8TeZLL3vBYmoSDTvkKTN2KpumNjERN82MwNKJgDhfSZ aXbeluzZAy/H7dJ2gtYGQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:CsJP4D+fqJ4=:+pk3Nbtb0DWvsRgkmo8SDy jWFD1hE+DZFnyf068FLiysPb6sHVo/fE9KLi1gEvUkZNWQYnUgKsGNKqP96zVNWsnGH94SerD ee6jTZWTKwqaBkfg6rZEbGvqP13/dBO1m/b38bnPZjTvXl2WVTGC/ZWo0W3YjoOLoHxUJ/p9T i5YFjBq6/0yassJ4+g9mAb4WYuXwOA8kBHB4sNxn5jqpDBXSxjqEK1DEy2iCz6nYyE2r6RfD1 1dFrrgcUiB9BtY/bBpjEqarvoYutqF0BUgG0jK4CaSt4hSe5sGKpTag1ba3qcfJooJd4mpOoE RiQqz2qAYMgfcMckSCOivW8ty5pvmAYB8vi5yyaAw8J92FSxCbkokSUZy1eCu3ZqwtwpsFY6r ppZo8Yopib06JuM/lhflpZ4d8zqYesSGVSZyY8BI6GOoa0G60XcadjpgAKh0KxuVO8a0Ny1xZ C3SF9v5mwaqq3JnChi2xLiVZWdrCEKrG3xdwJf9B8uVQizZWv3PxrrKTGI1Ui20haLKMsB+bl c85dTY9eJp4ZXtyAXN4alnBgaN/dhlRmKZcFKlGTKvG5LsE3xrA4zVtalYvam8ffUZj62XrYh 6Y1RuJ9OQa75qPPeMl0dXU8+Vh7xDeNC/xfuzwZwowI56clRDsVruE6qdY0rEA0pZJ8WT9YkS cl4PuKsZ7h/Lf+X/hAr3rGTrsrnKujmTAoGY+JJ7jlRDg2WuOoeyLCMKCdL1DRiVwJXxrHOKt /Zw3W4xam9/rVn0oAb8NXjBobkoRwPWOxt4lOF+MOMZfAF2UfbUj3CeJfOPPyiLVwA5L+fpgg rgnjwatA2A7cBfHrwL598eMSySCIQoL0hijte1u3f1GBP5+JxA= 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: Wed, 20 Sep 2017 16:30:13 +0200 Omit extra messages for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/usb/s2255/s2255drv.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index b2f239c4ba42..29285e8cd742 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -2242,13 +2242,9 @@ static int s2255_probe(struct usb_interface *interface, - if (dev == NULL) { - s2255_dev_err(&interface->dev, "out of memory\n"); + if (!dev) return -ENOMEM; - } dev->cmdbuf = kzalloc(S2255_CMDBUF_SIZE, GFP_KERNEL); - if (dev->cmdbuf == NULL) { - s2255_dev_err(&interface->dev, "out of memory\n"); + if (!dev->cmdbuf) goto errorFWDATA1; - } atomic_set(&dev->num_channels, 0); dev->pid = id->idProduct; @@ -2303,7 +2299,6 @@ static int s2255_probe(struct usb_interface *interface, - if (!dev->fw_data->pfw_data) { - dev_err(&interface->dev, "out of memory!\n"); + if (!dev->fw_data->pfw_data) goto errorFWDATA2; - } + /* load the first chunk */ if (request_firmware(&dev->fw_data->fw, FIRMWARE_FILE_NAME, &dev->udev->dev)) {