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

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

 




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.

> +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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux