From patchwork Sat Dec 10 20:50:03 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: 9469497 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 D5D1B60234 for ; Sat, 10 Dec 2016 20:50:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C72F228417 for ; Sat, 10 Dec 2016 20:50:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9EAC284E6; Sat, 10 Dec 2016 20:50:40 +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 6E1DB28417 for ; Sat, 10 Dec 2016 20:50:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752881AbcLJUuS (ORCPT ); Sat, 10 Dec 2016 15:50:18 -0500 Received: from mout.web.de ([212.227.15.3]:49251 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752094AbcLJUuQ (ORCPT ); Sat, 10 Dec 2016 15:50:16 -0500 Received: from [192.168.1.2] ([77.181.156.58]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MJIMc-1cE9dE3Fj0-002mBj; Sat, 10 Dec 2016 21:50:06 +0100 Subject: [PATCH 2/4] [media] bt8xx: Delete two error messages for a failed memory allocation To: linux-media@vger.kernel.org, Alexey Khoroshilov , Hans Verkuil , Mauro Carvalho Chehab References: Cc: LKML , kernel-janitors@vger.kernel.org, Wolfram Sang From: SF Markus Elfring Message-ID: Date: Sat, 10 Dec 2016 21:50:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:mm3EeYCL4bkMSbgAHswrpY2cr9NV5peSmtpPXRMvbBDbyB5fuRy 7kIDOzdcTXOIN8vq9x/1XNx2PELcriuurPDVSz5jKlAtgKtJd53mh7GgbZ7+wXQxVaZWpie yMq5g6obWTjEIdMtF4f225SUCjfTNytEqQMg3AQD+eVpX6qsT8iud79w1RslGsktXxZgtO0 l3pme9pXt+Tcq0s5fN2VA== X-UI-Out-Filterresults: notjunk:1; V01:K0:u3ku7TmOvns=:zjUdX23ONWWKoLkuTwG5rh h6iv6/VbIjYJBWK5vF+AKXUQSWunme6efnQBGxdUsMsv18B/Zx/8gRwk7UpZkWvxAGtSyCyZr EiuzQgbBw4+FwCg8XZbLGpAyWNVrW/vBNtPGkO5+xITtORKcjp76EFm2zfglAIpXxCf31jvbT 5YheWdSZtrAnPpAIXnaJBkNMI+BC3jPl70IGHQB6wnuzJUvuWMJh25qNS8dIBkwzAN4x4rzFC fXtrDq9zCAFuvzBHEXftMbuq5IJX+c6SorGMMpYmh7xhp13yiTQCdGZKQ5zqeReppCzaYsUbt Iso7jdEGDElUmqcXBTbyZT4Mg9HcO+OEsSSD8zSHgVs7tKUJdq1juTIZx+AK3Rud/R5mC4rH7 aK8/ACFJopnwmZBvJWY7mOfVH/Icsolar12XH/OFxqGU7VYzSUBDsEAJF6G5k/KSUm9YJF/HR N+7yRup/4f/eQma/a10r3lRcSBR7l3tAbfAgQHqto2UX6JDcAq6zN6UOZ5iPRkFX/CAvN0LQV MIQl4n1G+EYnn0ZfpioFhx1faA5IHhy/ZATUa8zY0r1fWBZEtsr/DBvtKTlLh72T3OQmxbTZ0 24X+HQMSwaZn6Ea8x3NS+FS8XW3Wrc/GV9sMHdGEyHVSt+fTQ0XSHK51B2pHtvEY9CIKqlx+5 k5S5yRdbQsEgFG8G6D13PSfONWJEQoexiFBTbWQwlQfuQYz0l9MrEhzrY92T6qtpmVX8UK134 AQDOi0PKGVXXdbnj0JrDKoShEUWMf5FkEPv3l3qp+zA08/nNZILY9fJpSfL8U5oiZ//STBGvK 4eqqzxa 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: Sat, 10 Dec 2016 20:50:58 +0100 Omit extra messages for a memory allocation failure in two functions. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring --- drivers/media/pci/bt8xx/dst_ca.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/bt8xx/dst_ca.c b/drivers/media/pci/bt8xx/dst_ca.c index 8681b9143a35..54e656ddd588 100644 --- a/drivers/media/pci/bt8xx/dst_ca.c +++ b/drivers/media/pci/bt8xx/dst_ca.c @@ -481,10 +481,9 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer; int result = 0; - if ((hw_buffer = kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { - dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); + hw_buffer = kmalloc(sizeof(*hw_buffer), GFP_KERNEL); + if (!hw_buffer) return -ENOMEM; - } dprintk(verbose, DST_CA_DEBUG, 1, " "); if (copy_from_user(p_ca_message, arg, sizeof (struct ca_msg))) { @@ -567,7 +566,6 @@ static long dst_ca_ioctl(struct file *file, unsigned int cmd, unsigned long ioct p_ca_slot_info = kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL); p_ca_caps = kmalloc(sizeof (struct ca_caps), GFP_KERNEL); if (!p_ca_message || !p_ca_slot_info || !p_ca_caps) { - dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); result = -ENOMEM; goto free_mem_and_exit; }