Re: [PATCH] drivers: power: Add support for bq24735 charger

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

 



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-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux