Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1191823

Re: [PATCH] power_supply: Adjust devm usage

From Vaishali Thakkar <vthakkar1994@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] power_supply: Adjust devm usage
Date 2015-07-24 15:20 +0200
Message-ID <pPL3l-6PY-37@gated-at.bofh.it> (permalink)
References <pPJNV-4T4-29@gated-at.bofh.it> <pPKgX-5Gn-29@gated-at.bofh.it> <pPKqC-5RA-5@gated-at.bofh.it> <pPKTF-6EB-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jul 24, 2015 at 6:29 PM, Sebastian Reichel <sre@kernel.org> wrote:
> Hi,
>
> On Fri, Jul 24, 2015 at 06:03:38PM +0530, Vaishali Thakkar wrote:
>> On Fri, Jul 24, 2015 at 5:56 PM, Sebastian Reichel <sre@kernel.org> wrote:
>> > On Fri, Jul 24, 2015 at 05:28:13PM +0530, Vaishali Thakkar wrote:
>> >> @@ -267,8 +267,9 @@ static int bq24735_charger_probe() {}
>> >> [...]
>> >
>> > Your patch is missing removal of the
>> > kfree(charger->charger_desc.name) in bq24735_charger_remove().
>>
>> Yes. Because it seems that this kfree is freeing some other data which
>> is not related to devm_kzalloc. I was not sure about removing it.
>> So, I was about to discuss it in a separate thread.s
>
> it's assigned in the probe function:
>
>     name = kasprintf(...);
>     ...
>     supply_desc->name = name;
>     ...
>     power_supply_register(..., supply_desc, ...);
>

Oh. Yes. I missed that.

>> Also, in the remove function we have devm_free_irq. I am unsure it
>> too. Because normally remove functions do not use devm
>> counterparts.
>
> It's required to free the irq before removing the power supply
> device.
>
> If the power supply is registered with devm, that should happen
> automatically, since it is requested before the irq.  Thus the
> remove function can be removed completely at that point :)

This makes sense. Thanks for explanation and review :)
So, can I send all changes along with getting rid of remove
function here in a single patch?

> -- Sebastian



-- 
Vaishali
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] power_supply: Adjust devm usage Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-07-24 14:00 +0200
  Re: [PATCH] power_supply: Adjust devm usage Frans Klaver <fransklaver@gmail.com> - 2015-07-24 14:20 +0200
    Re: [PATCH] power_supply: Adjust devm usage Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-07-24 14:30 +0200
      Re: [PATCH] power_supply: Adjust devm usage Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-07-24 14:40 +0200
  Re: [PATCH] power_supply: Adjust devm usage Sebastian Reichel <sre@kernel.org> - 2015-07-24 14:30 +0200
    Re: [PATCH] power_supply: Adjust devm usage Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-07-24 14:40 +0200
      Re: [PATCH] power_supply: Adjust devm usage Sebastian Reichel <sre@kernel.org> - 2015-07-24 15:10 +0200
        Re: [PATCH] power_supply: Adjust devm usage Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-07-24 15:20 +0200
          Re: [PATCH] power_supply: Adjust devm usage Sebastian Reichel <sre@kernel.org> - 2015-07-24 15:40 +0200
            Re: [PATCH] power_supply: Adjust devm usage Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-07-24 15:50 +0200
    Re: [PATCH] power_supply: Adjust devm usage Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-07-24 14:40 +0200
    Re: [PATCH] power_supply: Adjust devm usage Frans Klaver <fransklaver@gmail.com> - 2015-07-24 14:40 +0200
      Re: [PATCH] power_supply: Adjust devm usage Sebastian Reichel <sre@kernel.org> - 2015-07-24 15:10 +0200
  Re: [PATCH] power_supply: Adjust devm usage Pavel Machek <pavel@ucw.cz> - 2015-08-02 09:00 +0200
    Re: [PATCH] power_supply: Adjust devm usage Sebastian Reichel <sre@kernel.org> - 2015-08-03 19:40 +0200

csiph-web