From patchwork Sun Nov 2 18:27:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 5215641 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C1BD19F295 for ; Mon, 3 Nov 2014 09:52:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C8F782017A for ; Mon, 3 Nov 2014 09:52:33 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id A99D020166 for ; Mon, 3 Nov 2014 09:52:32 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id A6D7B260494; Mon, 3 Nov 2014 10:52:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 0B135260494; Mon, 3 Nov 2014 10:51:28 +0100 (CET) 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 6D71226042A; Sun, 2 Nov 2014 19:27:50 +0100 (CET) Received: from mout.web.de (mout.web.de [212.227.17.12]) by alsa0.perex.cz (Postfix) with ESMTP id 6EDAF260427 for ; Sun, 2 Nov 2014 19:27:42 +0100 (CET) Received: from [192.168.1.2] ([78.48.104.118]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0Ls91n-1YCFuE3YlT-013rNl; Sun, 02 Nov 2014 19:27:33 +0100 Message-ID: <54567788.9060008@users.sourceforge.net> Date: Sun, 02 Nov 2014 19:27:20 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:o57+CyZWRX8yN9NRj78n3d2etIIBUtQZyj0I4TQoS/DoQ+YKy/9 3pS1/x8/b5b9ZOYUHA9gJZEYmruayXAW8VKf62tQPqj2Pz+pDzOBBhcnxXnWdqaur7DhdOa 89anp4rkVKRLJuKE2oi9HuKwL9Sq5svyAXxfqu2Cqnau/L3Xf16GlVsZO3ta6OF0s350RHM nzCemOQK9JEiLooPQP9ug== X-UI-Out-Filterresults: notjunk:1; X-Mailman-Approved-At: Mon, 03 Nov 2014 10:51:22 +0100 Cc: trivial@kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Coccinelle Subject: [alsa-devel] [PATCH 1/1] PCI: EMU10K1: Deletion of unnecessary checks before three function calls 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 The functions kfree(), release_firmware() and snd_util_memhdr_free() test whether their argument is NULL and then return immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- sound/pci/emu10k1/emu10k1_main.c | 9 +++------ sound/pci/emu10k1/emufx.c | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) static int snd_emu10k1_add_controls(struct snd_emu10k1 *emu, diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 2292697..b4458a6 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -1289,10 +1289,8 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) } if (emu->emu1010.firmware_thread) kthread_stop(emu->emu1010.firmware_thread); - if (emu->firmware) - release_firmware(emu->firmware); - if (emu->dock_fw) - release_firmware(emu->dock_fw); + release_firmware(emu->firmware); + release_firmware(emu->dock_fw); if (emu->irq >= 0) free_irq(emu->irq, emu); /* remove reserved page */ @@ -1301,8 +1299,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) (struct snd_util_memblk *)emu->reserved_page); emu->reserved_page = NULL; } - if (emu->memhdr) - snd_util_memhdr_free(emu->memhdr); + snd_util_memhdr_free(emu->memhdr); if (emu->silent_page.area) snd_dma_free_pages(&emu->silent_page); if (emu->ptb_pages.area) diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 745f062..eb5c0ab 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -777,8 +777,7 @@ static void snd_emu10k1_ctl_private_free(struct snd_kcontrol *kctl) kctl->private_value = 0; list_del(&ctl->list); kfree(ctl); - if (kctl->tlv.p) - kfree(kctl->tlv.p); + kfree(kctl->tlv.p); }