From patchwork Mon Oct 24 21:00:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9393289 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 D3F406086B for ; Mon, 24 Oct 2016 21:01:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3415290A3 for ; Mon, 24 Oct 2016 21:01:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B811E290B5; Mon, 24 Oct 2016 21:01:28 +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=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 90DF8290B9 for ; Mon, 24 Oct 2016 21:01:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965532AbcJXVBC (ORCPT ); Mon, 24 Oct 2016 17:01:02 -0400 Received: from mout.web.de ([212.227.15.14]:62311 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965100AbcJXVBA (ORCPT ); Mon, 24 Oct 2016 17:01:00 -0400 Received: from [192.168.1.2] ([77.182.95.108]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0MSry9-1cOFI20bzB-00Rq71; Mon, 24 Oct 2016 23:00:47 +0200 Subject: [PATCH 2/3] [media] au0828-video: Delete three error messages for a failed memory allocation To: linux-media@vger.kernel.org, Hans Verkuil , Laurent Pinchart , Mauro Carvalho Chehab , =?UTF-8?Q?Rafael_Louren=c3=a7o_de_Lima_Chehab?= , Shuah Khan , Wolfram Sang References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <4bd439b2-731d-4b81-eb65-1efdc20cd231@users.sourceforge.net> Date: Mon, 24 Oct 2016 23:00:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:4z/8Q4Xy1Un2McwfsKWHMT8z5YQoCxnLFBbhTmvPi1JxEW3ScEI ZmWeOiigsFfo/9qGyuze0lj4fVk+AnYKWYudQWEUjft9TP3ypzAmHKR7DJNjtcWD1L/hfJo FXpB61aV/ayGahn9EKBe/9llZ37V5VWp/QNqo1ofYiCarotuiJw0elZLMxvTXk4xKNGln2O F00cHjIjpIE+np0fl61/Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:ksvPGaY56gY=:F8yj+B3bvvWL2wautS57iF TdinOJHnrelMLneGrXaX8GCqMNJzHXY6rS46pwZNJUXIjmSp6DsK8A4LoY+ETmIbaWY4OFm7C 9t2uXcQTvdth8X1gAHCH3eITNsmakDSHOz/0Q5qJVaSGE3Uz90DLyAoI8/9nk2B3M11UprNHb etG53NFe0FcBw/tUl2mpTVse/hkkN0ZtsesdX41LqbMVQ8mA8HMbil6oVsft4zGolb+Ed+89/ OSAtLDq+yP5+nb7n477y/AD4SxrlBI82gvHnCjKarwumQc7lHwMYLTH1iaL+49qxEh5xbiUU1 CW3EfbR4wvuXIlQONHTWRUpwijEV8n0O+O9wNhLhWawraRcTUyfhYnil4dZiFNe/nFqMNQgpN GM6eLZehxxIsyZoBz0n3/PjyTQol7Sexwsf6q+ZQFTNS31T+Kr44ZXczUCcXj9s54kGLqnRHM HcRL5qMzzFXuGa/7jrteQR0ODkyPRYnSLiad4x246mDbNju6rx8u5+M+z/1pK5C2ASRQPw8N3 J2CEup6ak32QLhrd/h5i99ZD7LFI7l5sPNE6/h5jUThi4U6MwhuiVYDQ4jTs5Uyinw0z4k2/a M1mnWs7ewS49BnEmGfGDaD/6l0IIOKG/A6DruwkyycxglL3KoLODHBzNYYj6+4ew8VEXs34WE YMX7KH8ISvZ3A6BZzM02G1B1IlSLjC0mhqDYCXoCXrJRFczATjJlthp1u1UyPQ863cHTeADHn vVYCKrYZbqsVbGfHRoCxmGQOKBOkkyV4g0q0oFhgbt31gEhof4mR8hOph05E3Pu7Bi9gP5JdT PJcIHdG 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: Mon, 24 Oct 2016 22:28:03 +0200 Omit extra messages for a memory allocation failure in this function. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring --- drivers/media/usb/au0828/au0828-video.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index 85b13c1..b5c88a7 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -224,17 +224,14 @@ static int au0828_init_isoc(struct au0828_dev *dev, int max_packets, dev->isoc_ctl.urb = kcalloc(num_bufs, sizeof(*dev->isoc_ctl.urb), GFP_KERNEL); - if (!dev->isoc_ctl.urb) { - au0828_isocdbg("cannot alloc memory for usb buffers\n"); + if (!dev->isoc_ctl.urb) return -ENOMEM; - } dev->isoc_ctl.transfer_buffer = kcalloc(num_bufs, sizeof(*dev->isoc_ctl .transfer_buffer), GFP_KERNEL); if (!dev->isoc_ctl.transfer_buffer) { - au0828_isocdbg("cannot allocate memory for usb transfer\n"); kfree(dev->isoc_ctl.urb); return -ENOMEM; } @@ -256,10 +253,6 @@ static int au0828_init_isoc(struct au0828_dev *dev, int max_packets, dev->isoc_ctl.transfer_buffer[i] = usb_alloc_coherent(dev->usbdev, sb_size, GFP_KERNEL, &urb->transfer_dma); if (!dev->isoc_ctl.transfer_buffer[i]) { - printk("unable to allocate %i bytes for transfer" - " buffer %i%s\n", - sb_size, i, - in_interrupt() ? " while in int" : ""); au0828_uninit_isoc(dev); return -ENOMEM; }