lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 19 Sep 2013 11:53:44 -0400
From:	Rhyland Klein <rklein@...dia.com>
To:	Manish Badarkhe <badarkhe.manish@...il.com>
CC:	Anton Vorontsov <anton@...msg.org>,
	David Woodhouse <dwmw2@...radead.org>,
	Darbha Sriharsha <dsriharsha@...dia.com>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>
Subject: Re: [PATCH] drivers: power: Add support for bq24735 charger

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 linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ