Re: [PATCHv2] adp1653: check error code of adp1653_init_controls

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

 



On Thu, 2011-07-28 at 16:34 +0200, Laurent Pinchart wrote: 
> > -	adp1653_init_controls(flash);
> > +	ret = adp1653_init_controls(flash);
> > +	if (ret)
> > +		goto free_and_quit;
> > 
> >  	ret = media_entity_init(&flash->subdev.entity, 0, NULL, 0);
> >  	if (ret < 0)
> > -		kfree(flash);
> > +		goto free_and_quit;
> > 
> > +	return 0;
> > +
> > +free_and_quit:
> > +	v4l2_ctrl_handler_free(&flash->ctrls);
> > +	kfree(flash);
> >  	return ret;

> What about
>         ret = adp1653_init_controls(flash);
>         if (ret)
>                 goto done;
> 
>         ret = media_entity_init(&flash->subdev.entity, 0, NULL, 0);
> 
> done:
>         if (ret < 0) {
>                 v4l2_ctrl_handler_free(&flash->ctrls);
>                 kfree(flash);
>         }
> 
>         return ret;
There is no difference at first glance. However, your variant is less
straight to understand for my opinion.

-- 
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