From patchwork Thu Oct 13 16:26:11 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: 9375351 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 CA7726075E for ; Thu, 13 Oct 2016 16:28:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA3062A162 for ; Thu, 13 Oct 2016 16:28:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE3CD2A164; Thu, 13 Oct 2016 16:28:03 +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 555112A162 for ; Thu, 13 Oct 2016 16:28:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932595AbcJMQ1A (ORCPT ); Thu, 13 Oct 2016 12:27:00 -0400 Received: from mout.web.de ([212.227.15.14]:52137 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756663AbcJMQ0Y (ORCPT ); Thu, 13 Oct 2016 12:26:24 -0400 Received: from [192.168.1.2] ([77.182.72.22]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0MbMg8-1bc5WC0w5c-00Ikq4; Thu, 13 Oct 2016 18:26:12 +0200 Subject: [PATCH 05/18] [media] RedRat3: Delete six messages for a failed memory allocation To: linux-media@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab , Sean Young , Wolfram Sang References: <566ABCD9.1060404@users.sourceforge.net> <81cef537-4ad0-3a74-8bde-94707dcd03f4@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: Date: Thu, 13 Oct 2016 18:26:11 +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: <81cef537-4ad0-3a74-8bde-94707dcd03f4@users.sourceforge.net> X-Provags-ID: V03:K0:suYZOaiosmI7iWXKTzRTI7D/dk7yCeqC3erxhYWOagDPPwtpCJG 2ah9nKxY2mbAE6o8hqgEWAl2PAcoWrfKYUSe3/ncSbkWDyE/ALO7+CYJOgZB8iVcgmZIGEZ 2CuS94XdzBczNHeNmQTuGcezoejST4OpSVU12UDErcnAMzir9+gfQl+s37QZjM23UP0AfJ6 Lu6M+Rs0QQ0mTd3zIxKhg== X-UI-Out-Filterresults: notjunk:1; V01:K0:AsJqO1CzRjc=:AbTdLu1DWJlWRYDIhhjLoF or0HMXaKb/Cn5aXjUhNbYruAQEzcfKfKb6k9HkjDtZxHxQiSPDr127Os1xQr0UBMO8aNZCkWM fNk87XRzbSThODE82qLHqI0L70S4QNKU9LcK5G0LB/XowJ8NtuemKRupRAxYs2v6EWhDyzk1h 5eCROzmv1NOHSIttqHTBLNUKkcWr6B48BBjHlj1TW05HaqXPVCzzDKY0hRfxlmVT3l7JTUq7G Elb3ErN5cjAQlUv4hjab/7eSun9iSR3gl2XyLjgX3xfSk5Smf+Upn1Z4OrDust+E1WprAXJQo tkUtGm2p6LfUtd9jMrQPA3rOqm9aq7s3D3TMYjJV3AAyK67mTZ00KGeD1WGjUK8tLR1WAXP0d CMTJmojYP2YQtn2vubmuLZ0iKDlMejHZUyKpnuYv8Tm0eI6FCUBjlMR0X1xWfmqTjWJMBn6sc DnzWCBHokaoL1R3ILaeaq0cGuFzxqvt1fN3pO1cEioWHrgpyRNciW2BANd6Esnh2Wg+DAgjmB 8UHpXqQicVgjS1KQncSZEpe3ZsiT1VX4xqI1CW/snTDwQtBs3yCSdJemsoicdgfpbIrd+tnPZ N9nphw7Ue9Ecxjen0MfeujGGr/bf6JOGfucxlKKTmeUt2SQ4mXwPZ7sJ9iOCbvpA57EhsqHpO PjPKf94wdp46XsLbrfkd3yTyVbRxP9X/YaByP7XBJj1Tw4zqzwUC1D0tqxdo4zK/hbCp+cuEP l/5jg4Ou76FCBmAoiMKg8hZctFmuQyGkoEzhhkaluoFIcc9xlYxQp6DeaviPRYj+MYG3dJLW/ 38qUryB 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: Thu, 13 Oct 2016 13:20:19 +0200 The script "checkpatch.pl" pointed information out like the following. WARNING: Possible unnecessary 'out of memory' message Thus remove such a logging statement in five functions. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring --- drivers/media/rc/redrat3.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 71e901d..2e31c18 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -453,10 +453,8 @@ static u32 redrat3_get_timeout(struct redrat3_dev *rr3) len = sizeof(*tmp); tmp = kzalloc(len, GFP_KERNEL); - if (!tmp) { - dev_warn(rr3->dev, "Memory allocation faillure\n"); + if (!tmp) return timeout; - } pipe = usb_rcvctrlpipe(rr3->udev, 0); ret = usb_control_msg(rr3->udev, pipe, RR3_GET_IR_PARAM, @@ -518,10 +516,8 @@ static void redrat3_reset(struct redrat3_dev *rr3) txpipe = usb_sndctrlpipe(udev, 0); val = kmalloc(len, GFP_KERNEL); - if (!val) { - dev_err(dev, "Memory allocation failure\n"); + if (!val) return; - } *val = 0x01; rc = usb_control_msg(udev, rxpipe, RR3_RESET, @@ -550,10 +546,8 @@ static void redrat3_get_firmware_rev(struct redrat3_dev *rr3) char *buffer; buffer = kcalloc(RR3_FW_VERSION_LEN + 1, sizeof(*buffer), GFP_KERNEL); - if (!buffer) { - dev_err(rr3->dev, "Memory allocation failure\n"); + if (!buffer) return; - } rc = usb_control_msg(rr3->udev, usb_rcvctrlpipe(rr3->udev, 0), RR3_FW_VERSION, @@ -866,10 +860,8 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3) u16 prod = le16_to_cpu(rr3->udev->descriptor.idProduct); rc = rc_allocate_device(); - if (!rc) { - dev_err(dev, "remote input dev allocation failed\n"); + if (!rc) goto out; - } snprintf(rr3->name, sizeof(rr3->name), "RedRat3%s " "Infrared Remote Transceiver (%04x:%04x)", @@ -959,10 +951,8 @@ static int redrat3_dev_probe(struct usb_interface *intf, /* allocate memory for our device state and initialize it */ rr3 = kzalloc(sizeof(*rr3), GFP_KERNEL); - if (rr3 == NULL) { - dev_err(dev, "Memory allocation failure\n"); + if (!rr3) goto no_endpoints; - } rr3->dev = &intf->dev; @@ -974,10 +964,8 @@ static int redrat3_dev_probe(struct usb_interface *intf, rr3->ep_in = ep_in; rr3->bulk_in_buf = usb_alloc_coherent(udev, le16_to_cpu(ep_in->wMaxPacketSize), GFP_KERNEL, &rr3->dma_in); - if (!rr3->bulk_in_buf) { - dev_err(dev, "Read buffer allocation failure\n"); + if (!rr3->bulk_in_buf) goto error; - } pipe = usb_rcvbulkpipe(udev, ep_in->bEndpointAddress); usb_fill_bulk_urb(rr3->read_urb, udev, pipe, rr3->bulk_in_buf,