From: drv <drv@mailo.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Bob Peterson <rpeterso@redhat.com>,
Andreas Gruenbacher <agruenba@redhat.com>,
gfs2@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org,
Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH] gfs2: Set error on error path
Date: Fri, 29 Sep 2023 13:02:51 +0530 [thread overview]
Message-ID: <f8e478c86bb80f37fbedc4f17b782918bc1c3607.camel@mailo.com> (raw)
In-Reply-To: <72de9c2e-7c60-4930-acfb-556a1f0fa4c4@kadam.mountain>
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.
> >
> > Signed-off-by: Deepak R Varma <drv@mailo.com>
> > ---
> > fs/gfs2/bmap.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > 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)
> >
> > down_write(&ip->i_rw_mutex);
> > page = grab_cache_page(inode->i_mapping, 0);
> > - error = -ENOMEM;
> > - if (!page)
> > + if (!page) {
> > + error = -ENOMEM;
> > goto out;
> > + }
>
> It used to be that the other way was faster? I'm pretty sure the
> compiler can figure it out these days. Please don't randomly start
> changing people's prefered style unless it's drivers/staging/ code.
>
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
>
prev parent reply other threads:[~2023-09-29 7:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 6:14 [PATCH] gfs2: Set error on error path Deepak R Varma
2023-09-29 7:14 ` Dan Carpenter
2023-09-29 7:32 ` drv [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f8e478c86bb80f37fbedc4f17b782918bc1c3607.camel@mailo.com \
--to=drv@mailo.com \
--cc=agruenba@redhat.com \
--cc=dan.carpenter@linaro.org \
--cc=error27@gmail.com \
--cc=gfs2@lists.linux.dev \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rpeterso@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox