lkml.org 
[lkml]   [2018]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Re: [PATCH] staging: media: davinci_vpfe: add error handling on kmalloc failure
On Mon, Mar 19, 2018 at 01:24:57PM +0900, Ji-Hun Kim wrote:
> > 1294 } else if (to && !from && size) {
> > 1295 rval = module_if->set(ipipe, NULL);
> > 1296 if (rval)
> > 1297 goto error;
> >
> > And here again goto free_params.
> >
> > 1298 }
> > 1299 kfree(params);
> > 1300 }
> > 1301 }
> > 1302 error:
> > 1303 return rval;
> >
> >
> > Change this to:
> >
> > return 0;
> Instead of returning rval, returning 0 would be fine? It looks that should
> return rval in normal case.
>

In the proposed code, the errors all do a return or a goto so "rval"
would be zero here. Then the error path would look like:

err_free_params:
kfree(params);
return rval;
}

regards,
dan carpenter


\
 
 \ /
  Last update: 2018-03-19 08:16    [W:0.407 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site