From patchwork Wed Sep 20 06:36:40 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: 9960901 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 9824360234 for ; Wed, 20 Sep 2017 06:36:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ADDA27D0C for ; Wed, 20 Sep 2017 06:36:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FE04284F4; Wed, 20 Sep 2017 06:36:50 +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 3D7FC27D0C for ; Wed, 20 Sep 2017 06:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751497AbdITGgt (ORCPT ); Wed, 20 Sep 2017 02:36:49 -0400 Received: from mout.web.de ([212.227.15.4]:53886 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751387AbdITGgs (ORCPT ); Wed, 20 Sep 2017 02:36:48 -0400 Received: from [192.168.1.2] ([77.181.108.184]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MQc7J-1dpQKS1UfF-00U2Bo; Wed, 20 Sep 2017 08:36:41 +0200 Subject: [PATCH 1/3] [media] pvrusb2-ioread: Use common error handling code in pvr2_ioread_get_buffer() From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Mike Isely Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Wed, 20 Sep 2017 08:36:40 +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: Content-Language: en-GB X-Provags-ID: V03:K0:yD3Rbsu+SFoX6zhi5SQ/tmTaTPQ3oil7KCd+eapiPjlY7ti8dov XYUQyxpKFF+TKxYlycZT+6k6zmo7EG1ommSpIwAfo0E2zXnMo6cwKVB+i4s2i+sKcXSo7G7 qyPN94CGISBsssbn64hsvF9sfNmIxyEnAXT94edoSvqdTYxjOj41fdzvFbJukwweEbt7H64 6ktZt8E6cZBptmLYcUcIA== X-UI-Out-Filterresults: notjunk:1; V01:K0:RzFHpU9e8t8=:j54zEfpM2CFy9mPsgtfW/1 qHa1A4TcTMbxvbA+BEiQK7WRi5P3RjAsTHF8FODcZxgzSPl1vB4DVzu7zbvbD7LRBAG4Y8mza V4Z5y3yTXcOYLwnEFH+zQBgjSvY4qY2KdMlzcvmkWZvIm8g9llDzDOSm6UcFtfdp31hLFIZoy HUkWQFkiOL3LPijucWjjfvwDUiId7S2YAfBifk/yS1RaDm3mFxnY3f2naTKzQwaGxe+BpEQmU 71oyO6/h6kYpSPNv7OR2MXpWAi2JjhEoKe7VfsrO02q2u5UVUXWin3PME78wFo/2Z6AyO35Sh FiVUm9IoZH11j/FUIxatZ2K8zdFeRY/xFeTlmqw3BJx3X2gJRUDtR5w0YofQXXU33WSKp6q3M VNAWkcfKu1SnOb8bGo5+AJVXp0iFErwtFgxlNcA4U0wVJCCPWWqqkeotj/heikVKpeoHp2ZMr 2b5CiFLAcqYkrdNehwy9eInTwjTP8nmGtu1NeiH8HSBP4TTZMLGUCt+UbXVmnQyN7e59CV9J2 4oj4qTtlqlYlWyeYcVCqeGT8/B1ySsrEfWQqRrNzBx88fMlh4+DW/v6zA7WOwrqi4JUFWkdBT HrCvXtGMZzBdYW0CxTlSTe1V3qIhjRnWjywFS1SENtnTeT70NmZc8HHYP2wV+wNK+ZL7GkgiI 6Eol6QQSXfHGYClkxB7+JtUypic5BI7LCIhvitHCnnIRpsWIN5xmiuMQu3mJRUD9hm9t92x4c daivYwBDUfQVOF+UC7HgLYysxGhe5ma2yEd18ZSmsdXPodmCdPoNYSNbGUnhxoSCk5GJ3yWcK 4I2Ksmc80dwTkx0mOsN0TrbYaFXfCXm6JMjfu8f2dQqEnHZr0g= 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: Tue, 19 Sep 2017 21:50:05 +0200 Add 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/pvrusb2/pvrusb2-ioread.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ioread.c b/drivers/media/usb/pvrusb2/pvrusb2-ioread.c index 602097bdcf14..0218614ce988 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-ioread.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-ioread.c @@ -266,8 +266,7 @@ static int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) pvr2_trace(PVR2_TRACE_DATA_FLOW, "/*---TRACE_READ---*/ pvr2_ioread_read id=%p queue_error=%d", cp,stat); - pvr2_ioread_stop(cp); - return 0; + goto stop_read; } cp->c_buf = NULL; cp->c_data_ptr = NULL; @@ -286,9 +285,8 @@ static int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) pvr2_trace(PVR2_TRACE_DATA_FLOW, "/*---TRACE_READ---*/ pvr2_ioread_read id=%p buffer_error=%d", cp,stat); - pvr2_ioread_stop(cp); // Give up. - return 0; + goto stop_read; } // Start over... continue; @@ -298,6 +296,10 @@ static int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) pvr2_buffer_get_id(cp->c_buf)]; } return !0; + +stop_read: + pvr2_ioread_stop(cp); + return 0; } static void pvr2_ioread_filter(struct pvr2_ioread *cp)