devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rhyland Klein <rklein-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Manish Badarkhe
	<badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Anton Vorontsov <anton-9xeibp6oKSgdnm+yROfE0A@public.gmane.org>,
	David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Darbha Sriharsha
	<dsriharsha-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] drivers: power: Add support for bq24735 charger
Date: Thu, 19 Sep 2013 11:53:44 -0400	[thread overview]
Message-ID: <523B1E08.6050003@nvidia.com> (raw)
In-Reply-To: <CAKDJKT4D7VV1pxC1Bme5wptEW=2uyWBccVCv06tTwgrW20diVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 9/19/2013 9:56 AM, Manish Badarkhe wrote:
> Hi
> 
>> +               ret = gpio_request(charger_device->pdata->status_gpio, name);
>> +               if (ret) {
>> +                       dev_err(&client->dev, "Failed gpio request: %d\n", ret);
>> +                       goto err_free_name;
>> +               }
>> +       }
> 
> snip ...
> 
>> +err_free_name:
>> +       if (name && name != charger_device->pdata->name)
>> +               kfree(name);
>> +
>> +       return ret;
>> +}
> 
> Like to know, Is there a need to free gpio which has been requested previously?
> Alternatively, this can be get requested using "devm_" function so
> that it will get
> freed automatically during removal.

As a matter of fact yes, I meant to use the devm_ variant, which is why
I don't have the cleanup. Thanks for catching this! Will fix in V2.

> 
>> +static int bq24735_charger_remove(struct i2c_client *client)
>> +{
>> +       struct bq24735_charger *charger_device = i2c_get_clientdata(client);
>> +
>> +       if (charger_device->irq)
>> +               devm_free_irq(charger_device->dev, charger_device->irq,
>> +                               &charger_device->charger);
>> +
>> +       power_supply_unregister(&charger_device->charger);
>> +
>> +       if (charger_device->charger.name != charger_device->pdata->name)
>> +               kfree(charger_device->charger.name);
>> +
>> +       return 0;
> 
> Ditto, If go with free_gpio.
> 
> 
> Regards
> Manish Badarkhe
> 

Thanks!

-rhyland

-- 
nvpublic
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2013-09-19 15:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17 21:10 [PATCH] drivers: power: Add support for bq24735 charger Rhyland Klein
     [not found] ` <1379452259-3499-1-git-send-email-rklein-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-19 13:56   ` Manish Badarkhe
     [not found]     ` <CAKDJKT4D7VV1pxC1Bme5wptEW=2uyWBccVCv06tTwgrW20diVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-19 15:53       ` Rhyland Klein [this message]

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=523B1E08.6050003@nvidia.com \
    --to=rklein-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=anton-9xeibp6oKSgdnm+yROfE0A@public.gmane.org \
    --cc=badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dsriharsha-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).