From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752168AbbL1Kga (ORCPT ); Mon, 28 Dec 2015 05:36:30 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:14573 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751906AbbL1Kg1 (ORCPT ); Mon, 28 Dec 2015 05:36:27 -0500 X-IronPort-AV: E=Sophos;i="5.20,490,1444687200"; d="scan'208";a="194768682" Date: Mon, 28 Dec 2015 11:36:03 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: SF Markus Elfring cc: linux-media@vger.kernel.org, Mauro Carvalho Chehab , LKML , kernel-janitors@vger.kernel.org Subject: Re: [media] tuners: One check less in m88rs6000t_get_rf_strength() after error detection In-Reply-To: <56810F56.4080306@users.sourceforge.net> Message-ID: References: <566ABCD9.1060404@users.sourceforge.net> <5680FDB3.7060305@users.sourceforge.net> <56810F56.4080306@users.sourceforge.net> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 28 Dec 2015, SF Markus Elfring wrote: > >> Move the jump label directly before the desired log statement > >> so that the variable "ret" will not be checked once more > >> after it was determined that a function call failed. > > > > Why not avoid both unnecessary ifs > > I would find such a fine-tuning also nice in principle at more source code places. > > > > and the enormous ugliness of a label inside an if by making two returns: > > a return 0 for success and a dev_dbg and return ret for failure? > > How should your suggestion finally work when the desired execution success > can be determined for such functions only after several other calls succeeded? Not idea what this means, but immediate return 0 followed by various code for reacting to an error is very common, so it looks like it should be possible here. julia From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julia Lawall Date: Mon, 28 Dec 2015 10:36:03 +0000 Subject: Re: [media] tuners: One check less in m88rs6000t_get_rf_strength() after error detection Message-Id: List-Id: References: <566ABCD9.1060404@users.sourceforge.net> <5680FDB3.7060305@users.sourceforge.net> <56810F56.4080306@users.sourceforge.net> In-Reply-To: <56810F56.4080306@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: SF Markus Elfring Cc: linux-media@vger.kernel.org, Mauro Carvalho Chehab , LKML , kernel-janitors@vger.kernel.org On Mon, 28 Dec 2015, SF Markus Elfring wrote: > >> Move the jump label directly before the desired log statement > >> so that the variable "ret" will not be checked once more > >> after it was determined that a function call failed. > > > > Why not avoid both unnecessary ifs > > I would find such a fine-tuning also nice in principle at more source code places. > > > > and the enormous ugliness of a label inside an if by making two returns: > > a return 0 for success and a dev_dbg and return ret for failure? > > How should your suggestion finally work when the desired execution success > can be determined for such functions only after several other calls succeeded? Not idea what this means, but immediate return 0 followed by various code for reacting to an error is very common, so it looks like it should be possible here. julia