2014-02-11 13:15:19

by Masanari Iida

[permalink] [raw]
Subject: [PATCH] clk:at91: Fix memory leak in of_at91_clk_master_setup()

cppcheck detected following error
[clk-master.c:245]: (error) Memory leak: characteristics

The original code forgot to free characteristics when
irq_of_parse_and_map() failed.

Signed-off-by: Masanari Iida <[email protected]>
---
drivers/clk/at91/clk-master.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
index bd313f7..c1af80b 100644
--- a/drivers/clk/at91/clk-master.c
+++ b/drivers/clk/at91/clk-master.c
@@ -242,7 +242,7 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,

irq = irq_of_parse_and_map(np, 0);
if (!irq)
- return;
+ goto out_free_characteristics;

clk = at91_clk_register_master(pmc, irq, name, num_parents,
parent_names, layout,
--
1.9.rc1


2014-02-11 13:24:16

by Boris BREZILLON

[permalink] [raw]
Subject: Re: [PATCH] clk:at91: Fix memory leak in of_at91_clk_master_setup()

On 11/02/2014 14:15, Masanari Iida wrote:
> cppcheck detected following error
> [clk-master.c:245]: (error) Memory leak: characteristics
>
> The original code forgot to free characteristics when
> irq_of_parse_and_map() failed.
>
> Signed-off-by: Masanari Iida <[email protected]>
Acked-by Boris BREZILLON <[email protected]>

Thanks for fixing this.

Best Regards,

Boris
> ---
> drivers/clk/at91/clk-master.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
> index bd313f7..c1af80b 100644
> --- a/drivers/clk/at91/clk-master.c
> +++ b/drivers/clk/at91/clk-master.c
> @@ -242,7 +242,7 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,
>
> irq = irq_of_parse_and_map(np, 0);
> if (!irq)
> - return;
> + goto out_free_characteristics;
>
> clk = at91_clk_register_master(pmc, irq, name, num_parents,
> parent_names, layout,

2014-02-15 16:47:07

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH] clk:at91: Fix memory leak in of_at91_clk_master_setup()

On 11/02/2014 at 22:15:07 +0900, Masanari Iida wrote :
> cppcheck detected following error
> [clk-master.c:245]: (error) Memory leak: characteristics
>
> The original code forgot to free characteristics when
> irq_of_parse_and_map() failed.
>
> Signed-off-by: Masanari Iida <[email protected]>

Acked-by: Alexandre Belloni <[email protected]>

> ---
> drivers/clk/at91/clk-master.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
> index bd313f7..c1af80b 100644
> --- a/drivers/clk/at91/clk-master.c
> +++ b/drivers/clk/at91/clk-master.c
> @@ -242,7 +242,7 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,
>
> irq = irq_of_parse_and_map(np, 0);
> if (!irq)
> - return;
> + goto out_free_characteristics;
>
> clk = at91_clk_register_master(pmc, irq, name, num_parents,
> parent_names, layout,
> --
> 1.9.rc1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

2014-02-15 17:08:20

by Boris BREZILLON

[permalink] [raw]
Subject: Re: [PATCH] clk:at91: Fix memory leak in of_at91_clk_master_setup()

Hi Mike,

Could you take this patch for the next 3.14 release ?

Best Regards,

Boris

On 11/02/2014 14:18, Boris BREZILLON wrote:
> On 11/02/2014 14:15, Masanari Iida wrote:
>> cppcheck detected following error
>> [clk-master.c:245]: (error) Memory leak: characteristics
>>
>> The original code forgot to free characteristics when
>> irq_of_parse_and_map() failed.
>>
>> Signed-off-by: Masanari Iida <[email protected]>
> Acked-by Boris BREZILLON <[email protected]>
>
> Thanks for fixing this.
>
> Best Regards,
>
> Boris
>> ---
>> drivers/clk/at91/clk-master.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/clk/at91/clk-master.c
>> b/drivers/clk/at91/clk-master.c
>> index bd313f7..c1af80b 100644
>> --- a/drivers/clk/at91/clk-master.c
>> +++ b/drivers/clk/at91/clk-master.c
>> @@ -242,7 +242,7 @@ of_at91_clk_master_setup(struct device_node *np,
>> struct at91_pmc *pmc,
>> irq = irq_of_parse_and_map(np, 0);
>> if (!irq)
>> - return;
>> + goto out_free_characteristics;
>> clk = at91_clk_register_master(pmc, irq, name, num_parents,
>> parent_names, layout,
>

2014-02-27 02:02:31

by Mike Turquette

[permalink] [raw]
Subject: Re: [PATCH] clk:at91: Fix memory leak in of_at91_clk_master_setup()

Quoting Boris BREZILLON (2014-02-15 09:08:12)
> Hi Mike,
>
> Could you take this patch for the next 3.14 release ?

Taken in for the next batch of fixes.

Regards,
Mike

>
> Best Regards,
>
> Boris
>
> On 11/02/2014 14:18, Boris BREZILLON wrote:
> > On 11/02/2014 14:15, Masanari Iida wrote:
> >> cppcheck detected following error
> >> [clk-master.c:245]: (error) Memory leak: characteristics
> >>
> >> The original code forgot to free characteristics when
> >> irq_of_parse_and_map() failed.
> >>
> >> Signed-off-by: Masanari Iida <[email protected]>
> > Acked-by Boris BREZILLON <[email protected]>
> >
> > Thanks for fixing this.
> >
> > Best Regards,
> >
> > Boris
> >> ---
> >> drivers/clk/at91/clk-master.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/clk/at91/clk-master.c
> >> b/drivers/clk/at91/clk-master.c
> >> index bd313f7..c1af80b 100644
> >> --- a/drivers/clk/at91/clk-master.c
> >> +++ b/drivers/clk/at91/clk-master.c
> >> @@ -242,7 +242,7 @@ of_at91_clk_master_setup(struct device_node *np,
> >> struct at91_pmc *pmc,
> >> irq = irq_of_parse_and_map(np, 0);
> >> if (!irq)
> >> - return;
> >> + goto out_free_characteristics;
> >> clk = at91_clk_register_master(pmc, irq, name, num_parents,
> >> parent_names, layout,
> >
>

2014-02-27 08:21:48

by Boris BREZILLON

[permalink] [raw]
Subject: Re: [PATCH] clk:at91: Fix memory leak in of_at91_clk_master_setup()

On 27/02/2014 03:02, Mike Turquette wrote:
> Quoting Boris BREZILLON (2014-02-15 09:08:12)
>> Hi Mike,
>>
>> Could you take this patch for the next 3.14 release ?
> Taken in for the next batch of fixes.
Thanks.
>
> Regards,
> Mike
>
>> Best Regards,
>>
>> Boris
>>
>> On 11/02/2014 14:18, Boris BREZILLON wrote:
>>> On 11/02/2014 14:15, Masanari Iida wrote:
>>>> cppcheck detected following error
>>>> [clk-master.c:245]: (error) Memory leak: characteristics
>>>>
>>>> The original code forgot to free characteristics when
>>>> irq_of_parse_and_map() failed.
>>>>
>>>> Signed-off-by: Masanari Iida <[email protected]>
>>> Acked-by Boris BREZILLON <[email protected]>
>>>
>>> Thanks for fixing this.
>>>
>>> Best Regards,
>>>
>>> Boris
>>>> ---
>>>> drivers/clk/at91/clk-master.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/clk/at91/clk-master.c
>>>> b/drivers/clk/at91/clk-master.c
>>>> index bd313f7..c1af80b 100644
>>>> --- a/drivers/clk/at91/clk-master.c
>>>> +++ b/drivers/clk/at91/clk-master.c
>>>> @@ -242,7 +242,7 @@ of_at91_clk_master_setup(struct device_node *np,
>>>> struct at91_pmc *pmc,
>>>> irq = irq_of_parse_and_map(np, 0);
>>>> if (!irq)
>>>> - return;
>>>> + goto out_free_characteristics;
>>>> clk = at91_clk_register_master(pmc, irq, name, num_parents,
>>>> parent_names, layout,