public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, sakari.ailus@maxwell.research.nokia.com
Subject: Re: [PATCH 6/9] as3645a: free resources in case of error properly
Date: Wed, 16 Nov 2011 12:52:25 +0200	[thread overview]
Message-ID: <1321440745.30587.28.camel@smile> (raw)
In-Reply-To: <201111161137.54083.laurent.pinchart@ideasonboard.com>

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@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2011-11-16 10:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15 16:21 [PATCH v4 0/2] as3645a flash driver Laurent Pinchart
2011-11-15 16:21 ` [PATCH v4 1/2] v4l: Add over-current and indicator flash fault bits Laurent Pinchart
2011-11-15 16:21 ` [PATCH v4 2/2] as3645a: Add driver for LED flash controller Laurent Pinchart
2011-11-15 17:49   ` [PATCH 0/9] as3645a: set of fixes up Andy Shevchenko
2011-11-15 17:49     ` [PATCH 1/9] as3645a: mention lm3555 as a clone of that chip Andy Shevchenko
2011-11-15 17:49     ` [PATCH 2/9] as3645a: print vendor and revision of the chip Andy Shevchenko
2011-11-16 10:32       ` Laurent Pinchart
2011-11-15 17:49     ` [PATCH 3/9] as3645a: remove unused code Andy Shevchenko
2011-11-15 17:49     ` [PATCH 4/9] as3645a: No error, no message Andy Shevchenko
2011-11-15 17:49     ` [PATCH 5/9] as3645a: move limits to the platform_data Andy Shevchenko
2011-11-15 17:49     ` [PATCH 6/9] as3645a: free resources in case of error properly Andy Shevchenko
2011-11-16 10:37       ` Laurent Pinchart
2011-11-16 10:52         ` Andy Shevchenko [this message]
2011-11-15 17:49     ` [PATCH 7/9] as3645a: use struct dev_pm_ops Andy Shevchenko
2011-11-15 17:50     ` [PATCH 8/9] as3645a: use pr_err macro instead of printk KERN_ERR Andy Shevchenko
2011-11-15 17:50     ` [PATCH 9/9] as3645a: use the same timeout for hw and sw strobes Andy Shevchenko
2011-11-16  6:53     ` [PATCH 0/9] as3645a: set of fixes up Sakari Ailus
2011-11-16  6:47 ` [PATCH v4 0/2] as3645a flash driver Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321440745.30587.28.camel@smile \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@maxwell.research.nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox