From patchwork Tue Sep 26 13:34:45 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: 9972041 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 884AA6037E for ; Tue, 26 Sep 2017 13:35:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8270E287B8 for ; Tue, 26 Sep 2017 13:35:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 756FD28825; Tue, 26 Sep 2017 13:35:02 +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 236E228812 for ; Tue, 26 Sep 2017 13:35:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030842AbdIZNfB (ORCPT ); Tue, 26 Sep 2017 09:35:01 -0400 Received: from mout.web.de ([212.227.17.12]:60027 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030262AbdIZNe7 (ORCPT ); Tue, 26 Sep 2017 09:34:59 -0400 Received: from [192.168.1.3] ([78.49.148.35]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MRl5x-1dm5Pj3DgX-00SyUp; Tue, 26 Sep 2017 15:34:46 +0200 Subject: [PATCH 1/2] [media] dmxdev: Use common error handling code in dvb_dmxdev_start_feed() From: SF Markus Elfring To: linux-media@vger.kernel.org, Devendra Sharma , Mauro Carvalho Chehab , Sakari Ailus , Thomas Gleixner Cc: LKML , kernel-janitors@vger.kernel.org References: <5f169dcb-b834-5ca3-2195-668e5295a7ca@users.sourceforge.net> Message-ID: <2c7d9cb4-983c-154c-6c0c-9d6a41bb82e1@users.sourceforge.net> Date: Tue, 26 Sep 2017 15:34:45 +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: <5f169dcb-b834-5ca3-2195-668e5295a7ca@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:OcPyrdWks19j4F3tFRTCA6oXpcfcHvlLFFNZ3GMTJJ+02/FYNfy tfnIcjmW6XTnPcBzapYbFgoQjg1O5vBDOMQ4lN815sE5uTtxm25UglrhSq30aYzj7UkE6Pl SAj1jvwqLk2FH/k1dUHIKHjMByl3mnF4HKCW87HTb8I+3hS7aOkWOzpcMO+jJWMYLerpwQg JMmG8Bq7mNw60MKOxroVw== X-UI-Out-Filterresults: notjunk:1; V01:K0:g9Fi/Da9BU0=:ue9kWWutHhzLP9W7lixREp Mie14VwuACuC1/U/gMPGdrkzIC4Y8m+xuPtgwtIJrzY3RBJaT/JIB61nJoQ343zsTlQx3ugYs EeJ6p3ycz0jxEChzz1pQx2Wx5tMpUlFiRLCb1F6T7g4MECoGBgibxOJXHAIGKmz05HSYde+3b BPgNV2FhYwgstiBWpC+1CYLGiTLeyHgy5LFo409fDbHtFUPVjmCXQPRia9b+sX4vqXiR7f0N2 /9VemqC3vwgV9wGfO9Kgs4ciHQKPEGLlKo/veiZk/Eohi6V3+yP8kY9o9unAWV3qmkgCzwLc+ 4vlpeM41b3loUQgcprf8vQ0jQnibi3wgvLf9hEFIdaFVgPQP+EEmkoLZuayJpUL+N5EO8n64+ DdtE//Wa0vpfYmqacJZgEjYmYZyLurbfkfp+ESn6RoNyvC9etZjo0rb/qjSKzFAKC1XtvnYrv w7vdpPdIluV1hCTLRPKNqmGSBoHlueRqTFx4TOCAc/fkQ6G9mM0rilwcnXvxNUE2T3nrBG2Sp Qtwb4Hhkn7zliVQv1JppzCCdWuL+N08UqX504pzx7RNr42SQFucdwfZuFiOszRc5E9hTD/cwz QgjBfT+DugTXjC/AZs9v/yRMc33cnlDgaO9dSdKSVJbaDV9ZzkqgFrxkSujf3vXI+RvIGwZEZ ngjw6zzrVH1M4wt0v8+4lhys7o7gG43FytVLb2+nca2l8h76lQoBw5Y06H3XoluQkdpb8u9Jv iuLqTUW+dxCWj8AmTCf7749TXRFYc+MCXR909t2tzxVVWNIYSe1efOCScTvSOUZowmHiltL/t 5viC/ibdBVzH1bUgRKq3XjC9IJ7VODSQFD28FtVpCzZZOk4ld0= 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, 26 Sep 2017 15:12:47 +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/dvb-core/dmxdev.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c index 45e91add73ba..f8bf7459d5ca 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c @@ -594,18 +594,18 @@ static int dvb_dmxdev_start_feed(struct dmxdev *dmxdev, tsfeed->priv = filter; ret = tsfeed->set(tsfeed, feed->pid, ts_type, ts_pes, timeout); - if (ret < 0) { - dmxdev->demux->release_ts_feed(dmxdev->demux, tsfeed); - return ret; - } + if (ret < 0) + goto release_feed; ret = tsfeed->start_filtering(tsfeed); - if (ret < 0) { - dmxdev->demux->release_ts_feed(dmxdev->demux, tsfeed); - return ret; - } + if (ret < 0) + goto release_feed; return 0; + +release_feed: + dmxdev->demux->release_ts_feed(dmxdev->demux, tsfeed); + return ret; } static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter)