From patchwork Fri May 4 17:50:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10381257 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 57E966037D for ; Fri, 4 May 2018 17:51:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 443D02955C for ; Fri, 4 May 2018 17:51:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40D882961A; Fri, 4 May 2018 17:51:33 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 103E629633 for ; Fri, 4 May 2018 17:50:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751748AbeEDRue (ORCPT ); Fri, 4 May 2018 13:50:34 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52210 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751740AbeEDRuc (ORCPT ); Fri, 4 May 2018 13:50:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xeWcvMUNb+KKN++tJDplz5qjn1rI/azGWVyP2qhIWq0=; b=a4O4bXnTvO6X+DyAdSPJoXTGb 5wDdj8Ha96mI//iQF5CSzx2LUc299MgktoPBSHx8/tUvE+MQZzjQq8zfva2GBVvXsx7JCAiATBEjT ooLnQMfBO8YpXe0OlZVTnzLRxL+N7oL0lKoTWNskveTowWmQemwEvt2HKmbN7ihfmN4U8WQTESGzz yJPiL455UCyjcbhRvGQp4P9+JxcppOF3QL+B/8qVeTvnHy5VugzJqnubT1EB6r0fTH+ZpmZJMvPW/ vnYxnH7MuVdmQsTCJ+l5j7Bc4iCgnYscSF5Sr4u4F/YWkOI2mxhBraM948UeauBj5LyaJ33erFCZ8 Hhwvm7dCg==; Received: from 177.17.129.114.dynamic.adsl.gvt.net.br ([177.17.129.114] helo=vento.lan) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fEeqf-0001uv-OO; Fri, 04 May 2018 17:50:26 +0000 Date: Fri, 4 May 2018 14:50:15 -0300 From: Mauro Carvalho Chehab To: SF Markus Elfring Cc: linux-media@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab , Al Viro , Andi Shyti , Andrew Morton , Andrey Utkin , Arvind Yadav , Bhumika Goyal , Bjorn Helgaas , Brian Johnson , Christoph =?UTF-8?B?QsO2aG13YWxkZXI=?= , Christophe Jaillet , Colin Ian King , Daniele Nicolodi , David =?UTF-8?B?SMOkcmRlbWFu?= , Devendra Sharma , "Gustavo A. R. Silva" , Inki Dae , Joe Perches , Kees Cook , Laurent Pinchart , Masahiro Yamada , Max Kellermann , Mike Isely , Philippe Ombredanne , Sakari Ailus , Santosh Kumar Singh , Satendra Singh Thakur , Sean Young , Seung-Woo Kim , Shyam Saini , Thomas Gleixner , Todor Tomov , Wei Yongjun , LKML , kernel-janitors@vger.kernel.org Subject: Re: [v3] [media] Use common error handling code in 19 functions Message-ID: <20180504144928.566ae507@vento.lan> In-Reply-To: <9e766f52-b09e-c61e-8d9f-23542d83f6b1@users.sourceforge.net> References: <227d2d7c-5aee-1190-1624-26596a048d9c@users.sourceforge.net> <57ef3a56-2578-1d5f-1268-348b49b0c573@users.sourceforge.net> <9e766f52-b09e-c61e-8d9f-23542d83f6b1@users.sourceforge.net> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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 Em Fri, 4 May 2018 18:08:59 +0200 SF Markus Elfring escreveu: > > Adjust jump targets so that a bit of exception handling can be better > > reused at the end of these functions. > > Why was this update suggestion rejected once more a moment ago? > > https://patchwork.linuxtv.org/patch/47827/ > lkml.kernel.org/r/<57ef3a56-2578-1d5f-1268-348b49b0c573@users.sourceforge.net> > https://lkml.org/lkml/2018/3/9/823 Taking just the first diff there as an example: and probably even produce the same code, as gcc will likely optimize it. It is also easier to review, as the error handling is closer to the code. On the other hand, there's nothing wrong on taking the approach you're proposing. In the end, using goto or not on error handling like the above is a matter of personal taste - and taste changes with time and with developer. I really don't have time to keep reviewing patches that are just churning the code just due to someone's personal taste. I'm pretty sure if I start accepting things like that, someone else would be on some future doing patches just reverting it, and I would be likely having to apply them too. So, except if the patch is really fixing something - e.g. a broken error handling code, I'll just ignore such patches and mark as rejected without further notice/comments from now on. Thanks, Mauro diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c index 61a750fae465..17d05b05fa9d 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c @@ -656,18 +656,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; } There's *nothing* wrong with the above. It works fine, avoids goto