From patchwork Tue Sep 5 20:36:17 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: 9939601 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 0C82E601EB for ; Tue, 5 Sep 2017 20:47:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1D0E289FB for ; Tue, 5 Sep 2017 20:47:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6AFC28A0C; Tue, 5 Sep 2017 20:47:32 +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=unavailable 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 5092928A14 for ; Tue, 5 Sep 2017 20:47:30 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 15966267343; Tue, 5 Sep 2017 22:36:58 +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 2995F267343; Tue, 5 Sep 2017 22:36:57 +0200 (CEST) Received: from mout.web.de (mout.web.de [212.227.17.12]) by alsa0.perex.cz (Postfix) with ESMTP id 8678B266BCF for ; Tue, 5 Sep 2017 22:36:55 +0200 (CEST) Received: from [192.168.1.2] ([85.182.50.20]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MZDKy-1e3h6d2cW4-00L1Rg; Tue, 05 Sep 2017 22:36:19 +0200 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Arnd Bergmann , Bhumika Goyal , Jaroslav Kysela , Takashi Iwai , Takashi Sakamoto References: <9832906e-3b04-b708-2c26-4755e0beb811@users.sourceforge.net> Message-ID: <3ec86adc-18bf-b3f9-341b-9d0ae70256a8@users.sourceforge.net> Date: Tue, 5 Sep 2017 22:36:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <9832906e-3b04-b708-2c26-4755e0beb811@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:VtUj7gOnyW6UYw2eNpF56XBE/s02ISgvXv0HA2CcVyhxiQOztet zNC3szTNEyw16nwgHZLGllrrG+XT6YeB5VYLI8NVWNERCYwJtI3vglT4hdPFRrFSvd4XlR4 ze0VsDa8OMw2k7EHriwcBD3pYTXgg8+JQUlEToB62ihvfozAZi691jt3yVySCVhvHHWs4L2 cH+dKfMkkMTM3GjY+9lEA== X-UI-Out-Filterresults: notjunk:1; V01:K0:vvm36hLtybk=:PBH+hiKEwqzuIfxpFXMLKH bHKKdFFNI0ReYwtYY6aTWuTZtRx7Vg+EECZdLqIVnOVPtbnBXGRKFQJ5b1PqEWA/fo+rtsQ4E COGHCeVg1PpBjlCEeZm0QrbVXvjBw85KSqav/p0BMjSf5XTYHSME1NNOtUYcdYxglGtDLxUfl oO7dcQuJZ8ST12AaiVkpRcnwryKCfFV5lQzzE4u0B+zZMdI/VErZEg8vicO0YzQAEh/LktqfW nY9YscOFoL69pwphsHEMB89sBJzAReAZDQyKATb8rDSIgESY0Xc3PMaXZ/NZ7vIprKZQxPp9S pReX8MvHb8Ebfnf/jS30fQZo3UE+cQgYS4xq3WrEzrHvp2W+r+tE0eKya4k5b2aeCpDGvAZkV Xz04P0U0mgnnkuSJ/b7JgdfQGITW6B3edTY/vkgstT+uvxy+Bj5YHiZBBwjkAhyVfb4iMuMzW 7re/JPLLUhKh6fVUInmyf/0hcBKtrMUzA8S47dh0e+F5G0W23JfHmFaXO81MMUqZRtTJbl3Pd 2iIYJRGDNckubxpqoM7sI74IiYX77Ouo8q397GS/Qmq4oI8mTWNrNzYlr7WVFDkOKH6TMPgSu gBdVfbbGPfIgoqOeOikcRZAKlNGyQvU0tPMC1Bz+qo80VQJqW2ilguCAP9nAGXWM7kre4k9Jw EPNoI5XuhEwM8ZNJT/5h4jw81P4yUYY1mNYWJX1o57yRl4ggP8sXAfCV8we3/Itlofw8QP6Z7 Zubg5+/2Vm4XsA0BZuFribKdlwWqiPfhSomPzZiIvRgT+eCJl5x0DiZ/qKCMa0yMeh579e2KA YLCkJ6yF2BjfMyh4I49egxJxPndfNq5+pzUOgO4249tRayS0NA= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 1/2] ALSA: rme9652: Use common code in hdsp_get_iobox_version() 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: Tue, 5 Sep 2017 22:08:30 +0200 Add a jump target so that a bit of common code can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- sound/pci/rme9652/hdsp.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 0ff41f9ab434..9f0f73875f01 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -793,11 +793,8 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200 | HDSP_PROGRAM); hdsp_write (hdsp, HDSP_fifoData, 0); - if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { - hdsp->io_type = Multiface; - dev_info(hdsp->card->dev, "Multiface found\n"); - return 0; - } + if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) + goto set_multi; hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); hdsp_write(hdsp, HDSP_fifoData, 0); @@ -810,20 +807,14 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300); hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); hdsp_write(hdsp, HDSP_fifoData, 0); - if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) { - hdsp->io_type = Multiface; - dev_info(hdsp->card->dev, "Multiface found\n"); - return 0; - } + if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) + goto set_multi; hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300); hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); hdsp_write(hdsp, HDSP_fifoData, 0); - if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { - hdsp->io_type = Multiface; - dev_info(hdsp->card->dev, "Multiface found\n"); - return 0; - } + if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) + goto set_multi; hdsp->io_type = RPM; dev_info(hdsp->card->dev, "RPM found\n"); @@ -838,6 +829,11 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) hdsp->io_type = Digiface; } return 0; + +set_multi: + hdsp->io_type = Multiface; + dev_info(hdsp->card->dev, "Multiface found\n"); + return 0; }