From patchwork Fri Aug 11 17:04:41 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: 9896373 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 A159260236 for ; Fri, 11 Aug 2017 17:05:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B2B4285B0 for ; Fri, 11 Aug 2017 17:05:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CEE627D29; Fri, 11 Aug 2017 17:05:00 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0555927D29 for ; Fri, 11 Aug 2017 17:04:58 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E5F0C2676B9; Fri, 11 Aug 2017 19:04:54 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E3F982676BA; Fri, 11 Aug 2017 19:04:53 +0200 (CEST) Received: from mout.web.de (mout.web.de [212.227.15.4]) by alsa0.perex.cz (Postfix) with ESMTP id 3A2AC26768D for ; Fri, 11 Aug 2017 19:04:51 +0200 (CEST) Received: from [192.168.1.2] ([77.181.164.13]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0McWXI-1dxkFP2A4m-00Helq; Fri, 11 Aug 2017 19:04:43 +0200 To: alsa-devel@alsa-project.org, Akshay Bhat , Daniel Mack , Dennis Kadioglu , Jaroslav Kysela , Johan Hovold , Nobutaka Okabe , Takashi Iwai From: SF Markus Elfring Message-ID: Date: Fri, 11 Aug 2017 19:04:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:RTRUMUmHUOb8q2NktAdjDbowTzVocSG77cDmabduCrGbczhhNGQ lbIq0Bj1uOpZa5+hIGbufl9h2ukuQVbcNRGLzpsF2esIkdUwiImzA78WdNncpg3IGiQeKsf AOnGKQfbRA3POsFZtDR1MOYVueicVEMH3btHfUXQiVLFm5nuiSvmDKZ9cdl6HVWsyKNP+Pz 4CW0WhrSxTFUcrspNpaNA== X-UI-Out-Filterresults: notjunk:1; V01:K0:FXKa4JYH4TA=:sxN4tDSlTtBS2EENCL+Pu3 sqdwOQtbKIaWrWIsgB3ZmzjdT7iG1UwES+JSy6HvBPpsXLVqyJqkuSL3kpmJddmsnaGBbV6i3 8ZQW+CRvZkv4lVc72dp81a1jGPsoc3q8ojJTv4kkbUp37ZBXhJ1j9lw2paDYtk0azURByn9cu 2NAAREaVSFec7A4A41zpI0SaMkvnGUL+Vhv9u4fq4iLxFBofmqq0bbuzsbOhsBx1rzCQEtANE MmC0NRh8WxVfyphy+ePvTv5vfjOH3w7EtEGIIuuwfJPtKTnlScfMgVWBFUv/8qujsmrcYaVze tvig809ED7HIntBjqdaz0D9MkC5KVAPfeNvxLAFirYTVxDsbrQdQuLou2MB7Olmyh0ZeYWr52 sfLqcpxhZTLS3INek2pVM7khD+0JunKWQfXmtFXyBYhx1lvBLtcFZ1uPDT69/+p5Z9eKOB/iT zGIYsCdbKrudfxmZ0tDroHCJbvupWUtbipFkKz4KbXUr86OlEn/mzXsf6LV1MUKtF4LibdEPO 0dCTIfetJaEz6B/Ey/5MfpgwFmNVB70/nCgdvJcmhfNPnLuo1SOZSPkAVX+WVRcjws4esQbJz GxKtjgwFiKmTEG0T+07IgQw+von36tW4KVErUUa0aeZAjIBKzvQuHvS4/6h20fu8rI7KR/7h6 nbhXkghy6xeFJdZ6dGpuHHTN2wuaKS/6urbvehN95GPI4V97LHBfBGMNsMJPLxRLhMOjPzQ1p w8gX7AHYgtT403D6GeeK/ilHKSjmdpA1v4HPFb7ZV5/0GlMAMz38qCNQ3Q6dBAFr0DzpQ9cyI PLt0uCKtnyl/ufsUKnidgSHAJWB2mon5GOXYK0W4gDB97aaXBQ= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH] ALSA: usb: Delete an error message for a failed memory allocation in two functions X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 11 Aug 2017 18:38:25 +0200 Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring --- sound/usb/quirks.c | 5 ++--- sound/usb/stream.c | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index d7b0b0a3a2db..9db40d58b4e2 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -146,10 +146,9 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, unsigned *rate_table = NULL; fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL); - if (!fp) { - usb_audio_err(chip, "cannot memdup\n"); + if (!fp) return -ENOMEM; - } + INIT_LIST_HEAD(&fp->list); if (fp->nr_rates > MAX_NR_RATES) { kfree(fp); diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 8e9548bc1f1a..d1776e5517ff 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -658,10 +658,8 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) continue; fp = kzalloc(sizeof(*fp), GFP_KERNEL); - if (! fp) { - dev_err(&dev->dev, "cannot malloc\n"); + if (!fp) return -ENOMEM; - } fp->iface = iface_no; fp->altsetting = altno;