linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Cao, Bingbu" <bingbu.cao@intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Zhi, Yong" <yong.zhi@intel.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] media: staging/intel-ipu3: reduce kernel stack usage
Date: Tue, 5 Mar 2019 10:47:20 +0200	[thread overview]
Message-ID: <20190305084720.jlgwd5ifouq3vvra@kekkonen.localdomain> (raw)
In-Reply-To: <CAK8P3a17qNvFvEVpjd5W0gwDn-HocW_ChDyeukiqHBbJbyAedQ@mail.gmail.com>

On Tue, Mar 05, 2019 at 09:40:24AM +0100, Arnd Bergmann wrote:
> On Tue, Mar 5, 2019 at 8:53 AM Sakari Ailus
> <sakari.ailus@linux.intel.com> wrote:
> > On Tue, Mar 05, 2019 at 12:25:18AM +0000, Cao, Bingbu wrote:
> 
> > > >     struct v4l2_pix_format_mplane *const in =
> > > >                                     &q[IPU3_CSS_QUEUE_IN].fmt.mpix;
> > > >     struct v4l2_pix_format_mplane *const out = @@ -1753,6 +1754,11 @@
> > > > int imgu_css_fmt_try(struct imgu_css *css,
> > > >                                     &q[IPU3_CSS_QUEUE_VF].fmt.mpix;
> > > >     int i, s, ret;
> > > >
> > > > +   if (!q) {
> > > > +           ret = -ENOMEM;
> > > > +           goto out;
> > > > +   }
> > > [Cao, Bingbu]
> > > The goto here is wrong, you can just report an error, and I prefer it is next to the alloc.
> >
> > I agree, the goto is just not needed.
> 
> Should I remove all the gotos then and do an explicit kfree() in each
> error path?
> 
> I'd prefer not to mix the two styles, as that can lead to subtle mistakes
> when the code is refactored again.

In this case there's no need for kfree as q is NULL. Goto is often useful
if you need to do things to undo stuff that was done earlier in the
function but it's not the case here. I prefer keeping the rest gotos.

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

  reply	other threads:[~2019-03-05  8:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 20:27 [PATCH] media: staging/intel-ipu3: reduce kernel stack usage Arnd Bergmann
2019-03-05  0:25 ` Cao, Bingbu
2019-03-05  7:53   ` Sakari Ailus
2019-03-05  8:40     ` Arnd Bergmann
2019-03-05  8:47       ` Sakari Ailus [this message]
2019-03-05  9:30         ` Arnd Bergmann

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=20190305084720.jlgwd5ifouq3vvra@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=bingbu.cao@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=yong.zhi@intel.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;
as well as URLs for NNTP newsgroup(s).