Re: [PATCH] regulator: core: Fix memory leak in regulator_resolve_supply()

2015-07-15 Thread Javier Martinez Canillas
Hello Mark, On 07/15/2015 05:52 PM, Mark Brown wrote: > On Wed, Jul 15, 2015 at 02:46:25PM +0200, Javier Martinez Canillas wrote: >> On 07/15/2015 01:27 PM, Mark Brown wrote: > >>> using _regulator_get() I think. A separate, rarely used, path is likely >>> to have this sort of issue. > >> Exact

Re: [PATCH] regulator: core: Fix memory leak in regulator_resolve_supply()

2015-07-15 Thread Mark Brown
On Wed, Jul 15, 2015 at 02:46:25PM +0200, Javier Martinez Canillas wrote: > On 07/15/2015 01:27 PM, Mark Brown wrote: > > using _regulator_get() I think. A separate, rarely used, path is likely > > to have this sort of issue. > Exactly, do you agree then that a try_module_get() is missing in set

Re: [PATCH] regulator: core: Fix memory leak in regulator_resolve_supply()

2015-07-15 Thread Javier Martinez Canillas
Hello Mark, On 07/15/2015 01:27 PM, Mark Brown wrote: > On Wed, Jul 15, 2015 at 10:38:38AM +0200, Javier Martinez Canillas wrote: >> On 07/15/2015 10:01 AM, Krzysztof Kozlowski wrote: > >>> The _regulator_put() reverts more work than create_regulator() did, >>> e.g.: module_put and rdev->open_cou

Re: [PATCH] regulator: core: Fix memory leak in regulator_resolve_supply()

2015-07-15 Thread Mark Brown
On Wed, Jul 15, 2015 at 10:38:38AM +0200, Javier Martinez Canillas wrote: > On 07/15/2015 10:01 AM, Krzysztof Kozlowski wrote: > > The _regulator_put() reverts more work than create_regulator() did, > > e.g.: module_put and rdev->open_count--. Maybe you need a > > destroy_regulator() function? >

Re: [PATCH] regulator: core: Fix memory leak in regulator_resolve_supply()

2015-07-15 Thread Javier Martinez Canillas
Hello Krzysztof, Thanks a lot for your feedback. On 07/15/2015 10:01 AM, Krzysztof Kozlowski wrote: > 2015-07-14 23:21 GMT+09:00 Javier Martinez Canillas : >> The regulator_resolve_supply() function calls set_supply() which in turn >> calls create_regulator() to allocate a supply regulator. >> >>

Re: [PATCH] regulator: core: Fix memory leak in regulator_resolve_supply()

2015-07-15 Thread Krzysztof Kozlowski
2015-07-14 23:21 GMT+09:00 Javier Martinez Canillas : > The regulator_resolve_supply() function calls set_supply() which in turn > calls create_regulator() to allocate a supply regulator. > > If an error occurs after set_supply() succeeded, the allocated regulator > has to be freed before propagati