From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailo.com (msg-1.mailo.com [213.182.54.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E1E1399 for ; Fri, 29 Sep 2023 07:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1695972824; bh=Mxk9l/U073uStCFV2UzL0Jvqq/Vo4Ln1BTaY+q264Og=; h=X-EA-Auth:Message-ID:Subject:From:To:Cc:Date:In-Reply-To: References:Content-Type:Content-Transfer-Encoding:MIME-Version; b=h4UfrgMc/GsgctxJuapIvK1n7NV2LISZyjM4eagWufGdxYn3a8T9eGQXeex2tADbM RuSfnz0Aa2M1r9OmxMjaANzArsx8eleoOeYnBkl5bAn7kmPTMU47MmBq66hAGYQnXS ffsVjkZKidUECmxdEiX+EkZhCkxEgQWxHEYbKBkg= Received: by b221-6.in.mailobj.net [192.168.90.26] with ESMTP via ip-20.mailobj.net [213.182.54.20] Fri, 29 Sep 2023 09:33:44 +0200 (CEST) X-EA-Auth: Kph+n6amj/OpMbnfaagrjIvIfM2f1llYlstIKcYMbu7B9oWx5SNQR1QBvj0B4fmVvei9+OhAtDxj3qPLNaYgUr/AVERwIYts Message-ID: Subject: Re: [PATCH] gfs2: Set error on error path From: drv To: Dan Carpenter Cc: Bob Peterson , Andreas Gruenbacher , gfs2@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Dan Carpenter Date: Fri, 29 Sep 2023 13:02:51 +0530 In-Reply-To: <72de9c2e-7c60-4930-acfb-556a1f0fa4c4@kadam.mountain> References: <72de9c2e-7c60-4930-acfb-556a1f0fa4c4@kadam.mountain> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: gfs2@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2023-09-29 at 10:14 +0300, Dan Carpenter wrote: > On Fri, Sep 29, 2023 at 11:44:40AM +0530, Deepak R Varma wrote: > > Set the error variable inside the error path on failure. Saves > > unnecessary variable assignment during normal execution. > >=20 > > Signed-off-by: Deepak R Varma > > --- > > =C2=A0fs/gfs2/bmap.c | 5 +++-- > > =C2=A01 file changed, 3 insertions(+), 2 deletions(-) > >=20 > > diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c > > index ef7017fb6951..93bd8ea34444 100644 > > --- a/fs/gfs2/bmap.c > > +++ b/fs/gfs2/bmap.c > > @@ -162,9 +162,10 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip) > > =C2=A0 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0down_write(&ip->i_rw_mu= tex); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0page =3D grab_cache_pag= e(inode->i_mapping, 0); > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0error =3D -ENOMEM; > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (!page) > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (!page) { > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0error =3D -ENOMEM; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0goto out; > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} >=20 > It used to be that the other way was faster?=C2=A0 I'm pretty sure the > compiler can figure it out these days.=C2=A0 Please don't randomly start > changing people's prefered style unless it's drivers/staging/ code. >=20 Hi Dan, Thank you for the feedback. I did not know about the compiler optimization resulting in original code being faster. I will let the maintainers comment on breaking the style. regards, deepak. > regards, > dan carpenter >=20