Re: [PATCH 6/9] as3645a: free resources in case of error properly

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

 



On Wed, 2011-11-16 at 11:37 +0100, Laurent Pinchart wrote: 
> > @@ -812,13 +814,12 @@ static int as3645a_probe(struct i2c_client *client,
> > 
> >  	flash->led_mode = V4L2_FLASH_LED_MODE_NONE;
> > 
> > -	ret = as3645a_init_controls(flash);
> > -	if (ret < 0) {
> > -		kfree(flash);
> > -		return ret;
> > -	}
> > -
> 
> Would you mind if I replace this code below
> 
> >  	return 0;
> > +
> > +free_and_quit:
> > +	v4l2_ctrl_handler_free(&flash->ctrls);
> > +	kfree(flash);
> > +	return ret;
> 
> with
> 
> done:
> 	if (ret < 0) {
> 		v4l2_ctrl_handler_free(&flash->ctrls);
> 		kfree(flash);
> 	}
> 
> 	return ret;
> 

I'm okay with it. However, I don't know if the compiler could optimize
double check here.


-- 
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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