From patchwork Fri Sep 22 17:06:01 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: 9966659 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 55A8560381 for ; Fri, 22 Sep 2017 17:06:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 408EF29927 for ; Fri, 22 Sep 2017 17:06:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34F542995A; Fri, 22 Sep 2017 17:06:22 +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 C8C5629927 for ; Fri, 22 Sep 2017 17:06:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752477AbdIVRGU (ORCPT ); Fri, 22 Sep 2017 13:06:20 -0400 Received: from mout.web.de ([212.227.17.12]:49314 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752341AbdIVRGQ (ORCPT ); Fri, 22 Sep 2017 13:06:16 -0400 Received: from [192.168.1.2] ([78.48.204.216]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LdF4n-1dUwKw0sNt-00iQoS; Fri, 22 Sep 2017 19:06:03 +0200 To: linux-media@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] [media] spca500: Use common error handling code in spca500_synch310() Message-ID: Date: Fri, 22 Sep 2017 19:06:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:4eqJTeBQk097sjIPyeZQ9uRfMeHodpADHvpzZXlvyRsLHxWvMsu JUs9rvVxlmj2nnW1kk2W3J7C2/EhbkMMSq2YTI/4ByPsGnmnqFs8rpcUz2QP9WDGK5k9DZ+ BEQxr/4LZ//cxw2CjlB0j0DDfHeH34aoc7lK+Cr6dQpFBDWnAI0sgkINGXR2IVJa93cxlVu 2ziODgWEWncLcHOTQXnYA== X-UI-Out-Filterresults: notjunk:1; V01:K0:nCXSGTtpDHw=:lZTHzQTkI3mbJZnUBI5nEZ 57fS4kfa6jRyKa5tOO2qXeA2bzlf6eZ/nBLST6//uz0aFnQfMvHW6k5BJB/fphRGpYkfUAtLu SeCSc7VELdCvBVvgizTlXAGAP1DSNSdbdqiAgqA4sZModENNcGQt6mz8q+h55aTwvWJ7BlJoE KzLW3hX7KIxq04aOZ8dL46p0z6POXdG5lMADwavofO/iZ99ExvPi3wnfthSmktVe66K8wWvQq Usn0MdcJOMJfFF40F/2BEYXu7/rd+r1zwYhP29arHwHmtIQ/ZQIhmnWvZnqCO8/mZZ6Xb2sN9 7G4+AcLoztEIAP3/ucekzoy4WIf9wfUV/JX+gPgAY0VajZqF6BylVDe4exp1q6DIy+hx/DCSi YR6l0GHzoxljXqRNghksC61fG2IPeGfB/4YMEGjCPI0DHxnnvUoQNVBQNnmyKhjhuA7Dv02Lo xz1jhGi6mMBqkhx0UszEPqRnkhKy8eESIy6mAoX9AzWl4xL7ouUk32x5kRPPYHRkUmTp38UUz yllre9BuJM6bivftrt6Nj4qDzvPkgjV6nL4Vp5nZRMsD+532IsYVZvLVtCjelhBiRbVuytBeb OoXTKEvebic2nOH2XbFLNrILO2z1AK9RdDYrfKBsZgZo/ufU/m0C5C6nZjKUTY8GE5DAX9gzx 3IlRpYLpwZKLofBDN2quivC5RqoKv3NFH/dLBxrCRfaulljDYEUi3fRfWEkbt8FpFryzGmSk/ QV4s/lHggNTG3H+fFQzasyDJ6Y7+Q+wkeyoIyVMfMtDQPx9uFe9rmGMET+fnXZAVcZwqJ/juR e9APLI/ZCq6VTmWp1MAyQwP215Gk3qFfLB/AdMRG/lopVpWm+k= 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: Fri, 22 Sep 2017 18:45:07 +0200 Adjust a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/usb/gspca/spca500.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/media/usb/gspca/spca500.c b/drivers/media/usb/gspca/spca500.c index da2d9027914c..1f224f5e5b19 100644 --- a/drivers/media/usb/gspca/spca500.c +++ b/drivers/media/usb/gspca/spca500.c @@ -501,7 +501,6 @@ static int spca500_full_reset(struct gspca_dev *gspca_dev) static int spca500_synch310(struct gspca_dev *gspca_dev) { - if (usb_set_interface(gspca_dev->dev, gspca_dev->iface, 0) < 0) { - PERR("Set packet size: set interface error"); - goto error; - } + if (usb_set_interface(gspca_dev->dev, gspca_dev->iface, 0) < 0) + goto report_failure; + spca500_ping310(gspca_dev); @@ -514,12 +513,12 @@ static int spca500_synch310(struct gspca_dev *gspca_dev) /* Windoze use pipe with altsetting 6 why 7 here */ - if (usb_set_interface(gspca_dev->dev, - gspca_dev->iface, - gspca_dev->alt) < 0) { - PERR("Set packet size: set interface error"); - goto error; - } + if (usb_set_interface(gspca_dev->dev, gspca_dev->iface, gspca_dev->alt) + < 0) + goto report_failure; + return 0; -error: + +report_failure: + PERR("Set packet size: set interface error"); return -EBUSY; }