From patchwork Wed Sep 20 17:01:34 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: 9961875 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 F2BC560208 for ; Wed, 20 Sep 2017 17:02:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E13E4291BB for ; Wed, 20 Sep 2017 17:02:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D56C5291C6; Wed, 20 Sep 2017 17:02: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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 7BF68291BF for ; Wed, 20 Sep 2017 17:02:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751629AbdITRBr (ORCPT ); Wed, 20 Sep 2017 13:01:47 -0400 Received: from mout.web.de ([212.227.15.14]:53075 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751001AbdITRBp (ORCPT ); Wed, 20 Sep 2017 13:01:45 -0400 Received: from [192.168.1.2] ([77.181.108.184]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LqlF4-1dPD370CDy-00eOFx; Wed, 20 Sep 2017 19:01:35 +0200 Subject: [PATCH 4/5] [media] s2255drv: Use common error handling code in read_pipe_completion() From: SF Markus Elfring To: linux-media@vger.kernel.org, Arvind Yadav , Bhumika Goyal , Laurent Pinchart , Mauro Carvalho Chehab , Mike Isely , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: <55718a41-d76f-36bf-7197-db92014dcd3c@users.sourceforge.net> Message-ID: <8e0409dd-0228-c15d-260c-b8d4e18eb07b@users.sourceforge.net> Date: Wed, 20 Sep 2017 19:01:34 +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: <55718a41-d76f-36bf-7197-db92014dcd3c@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:XoBRE7qS1S34NuRu3w9tYo6IGwEZTap5i9vKIrnX2MfD7KbRe4r 6M4ZY1ZgGZTyONndz38u3eSLUy9Dgns2e6tpELirs0YOJbCGZ+kJdVDfuRJfH3NpMiQLeOG IR2deHNl2MI0Ix8ts2l3/22zGdfQvnnrfvBeCTKRX31+dPFlOgN2i9vvfusx1iSP5Q4HhmX nUfsWf4V3xHxuAcYnPEcA== X-UI-Out-Filterresults: notjunk:1; V01:K0:9jws8Qx3yJk=:RERJ2d6McnlVm+rB+AxPDF XrUQElIDU54dRtjqn6nfHrdazUF9FOKdKHkRhGMcqxFPP0Nxije52jHncwmHMwNajKO+00QTu qfpgkhN+PTjoIq+ZeyrOiSAXvbmJzt8JnE3FgMvrk8B+VGKIvpvb6BxnIWarA0Q/0ep95HtKM /oRDq//zUpUUAYLSfqgUPjwiyuZ8ndsC3wITxG4rvzn2SmVXyIjf53YLUO9sgKvRswoyAbwXb Nm5oRdoXq2Gfw4FofZRJ829gGtGtH25ARAhkFZ6k9Ns6x6jj2G3tMcMWVmGHZYdZjnNAi8rM8 M09pmDeKvjrOIHVCBWWTauDW9kNTxrjel6X+9JVRqWOw2b1BQsOxPxs9dcvvc6bmssKxX4qqW iZXVAyFAIVGY7yVBwl5rzgi8GviHSFiIRbtQcut65tnuJRtXzm9GubICDZlAEO5IM1f8YpJ07 fopoO8Hq+7pv+cl4jZLxjz8PSKCgwCLIpS6R7MSOLySFe16U5qRIsFGi2qNfJWAXFKxPHfLZg 7wn0D3pmqGFCzmI4PEkVu/sxtV4ul5vp5noakKHRtVC4nbeZ7A/E+t/eDVqMmIcKki4kNKh/q u01VS3Su9qwMw5OYa/Bj9hT8+axJdQsIXeQoBvybx5yf2JbabYOLrgN7XZXKNETDbpmCSCROf C0hHXkAfpgAUcGYOy2UNSLpFpoUCAmPouVxIclqQJv7GngyluwTBcmksHl+LkvgB0fBU7kerh v0J4ki8gwdRHIxrz1ZPeJ2G+cBMrODK1ozMnRH4Hftcd1XAD9KDCpVf/CiltGXdCmr0L1Q42Q vyH2eHvjU3e8+2ysej3pUVbdoirEseEhSDZB0mBc+AAFOvsORE= 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: Wed, 20 Sep 2017 17:45:13 +0200 Add a jump target so that a bit of exception handling can be better reused at the end of this function. Signed-off-by: Markus Elfring --- drivers/media/usb/s2255/s2255drv.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 29bc73ad7d8a..5a5d5ae833ff 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -2065,11 +2065,9 @@ static void read_pipe_completion(struct urb *purb) pipe_info = purb->context; - if (!pipe_info) { - dev_err(&purb->dev->dev, "no context!\n"); - return; - } + if (!pipe_info) + goto report_failure; + dev = pipe_info->dev; - if (!dev) { - dev_err(&purb->dev->dev, "no context!\n"); - return; - } + if (!dev) + goto report_failure; + status = purb->status; @@ -2107,6 +2105,9 @@ static void read_pipe_completion(struct urb *purb) dprintk(dev, 2, "%s :complete state 0\n", __func__); } return; + +report_failure: + dev_err(&purb->dev->dev, "no context!\n"); } static int s2255_start_readpipe(struct s2255_dev *dev)