Re: Re: [PATCH] staging: media: davinci_vpfe: add error handling on kmalloc failure

From: Dan Carpenter
Date: Mon Mar 19 2018 - 03:15:21 EST


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