Re: [PATCH] media: staging/intel-ipu3: reduce kernel stack usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 5, 2019 at 9:47 AM Sakari Ailus
<sakari.ailus@xxxxxxxxxxxxxxx> wrote:
> 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@xxxxxxxxxxxxxxx> 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.

Ok, I'll send an updated patch the way you suggested then.

     Arnd



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux