From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx4-phx2.redhat.com ([209.132.183.25]:51912 "EHLO mx4-phx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753886AbbESMIW (ORCPT ); Tue, 19 May 2015 08:08:22 -0400 Date: Tue, 19 May 2015 08:05:56 -0400 (EDT) From: Federico Simoncelli To: Mauro Carvalho Chehab Cc: Linux Media Mailing List , Mauro Carvalho Chehab , Lars-Peter Clausen , Michael Buesch , Antti Palosaari , Hans Verkuil , Sakari Ailus , Ondrej Zary , Ramakrishnan Muthukrishnan , Laurent Pinchart , Takashi Iwai , Amber Thrall , James Harper , Dan Carpenter , Konrad Rzeszutek Wilk Message-ID: <577085828.1080862.1432037155994.JavaMail.zimbra@redhat.com> In-Reply-To: References: <0fee1624f3df1827cb6d0154253f9c45793bf3e1.1432033220.git.mchehab@osg.samsung.com> <0fee1624f3df1827cb6d0154253f9c45793bf3e1.1432033220.git.mchehab@osg.samsung.com> Subject: Re: [PATCH 2/2] drivers: Simplify the return code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-media-owner@vger.kernel.org List-ID: ----- Original Message ----- > From: "Mauro Carvalho Chehab" > To: "Linux Media Mailing List" > Cc: "Mauro Carvalho Chehab" , "Mauro Carvalho Chehab" , "Lars-Peter > Clausen" , "Michael Buesch" , "Antti Palosaari" , "Hans Verkuil" > , "Sakari Ailus" , "Ondrej Zary" , > "Ramakrishnan Muthukrishnan" , "Laurent Pinchart" , "Takashi > Iwai" , "Amber Thrall" , "Federico Simoncelli" , > "James Harper" , "Dan Carpenter" , "Konrad Rzeszutek Wilk" > > Sent: Tuesday, May 19, 2015 1:00:57 PM > Subject: [PATCH 2/2] drivers: Simplify the return code > > If the last thing we do in a function is to call another > function and then return its value, we don't need to store > the returned code into some ancillary var. > > Signed-off-by: Mauro Carvalho Chehab > > diff --git a/drivers/media/dvb-frontends/lgs8gxx.c > b/drivers/media/dvb-frontends/lgs8gxx.c > index 3c92f36ea5c7..9b0166cdc7c2 100644 > --- a/drivers/media/dvb-frontends/lgs8gxx.c > +++ b/drivers/media/dvb-frontends/lgs8gxx.c > @@ -544,11 +544,7 @@ static int lgs8gxx_set_mpeg_mode(struct lgs8gxx_state > *priv, > t |= clk_pol ? TS_CLK_INVERTED : TS_CLK_NORMAL; > t |= clk_gated ? TS_CLK_GATED : TS_CLK_FREERUN; > > - ret = lgs8gxx_write_reg(priv, reg_addr, t); > - if (ret != 0) > - return ret; > - > - return 0; > + return lgs8gxx_write_reg(priv, reg_addr, t); > } Personally I prefer the current style because it's more consistent with all the other calls in the same function (return ret when ret != 0). It also allows you to easily add/remove calls without having to deal with the last special case return my_last_fun_call(...). Anyway it's not a big deal, I think it's your call. -- Federico