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


Groups > linux.kernel > #1380546 > unrolled thread

Re: [PATCH] PM / clk: ensure we don't allocate a -ve size of count clks

Started byPavel Machek <pavel@ucw.cz>
First post2016-04-16 15:00 +0200
Last post2016-04-16 15:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] PM / clk: ensure we don't allocate a -ve size of count  clks Pavel Machek <pavel@ucw.cz> - 2016-04-16 15:00 +0200
    Re: [PATCH] PM / clk: ensure we don't allocate a -ve size of count  clks Colin Ian King <colin.king@canonical.com> - 2016-04-16 15:50 +0200

#1380546 — Re: [PATCH] PM / clk: ensure we don't allocate a -ve size of count clks

FromPavel Machek <pavel@ucw.cz>
Date2016-04-16 15:00 +0200
SubjectRe: [PATCH] PM / clk: ensure we don't allocate a -ve size of count clks
Message-ID<roxZn-3zW-1@gated-at.bofh.it>
On Sat 2016-04-16 13:50:03, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> It is entirely possible for of_count_phandle_wit_args to
> return a -ve error return value so we need to check for this
> otherwise we end up allocating a negative number of clk objects.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Pavel Machek <pavel@ucw.cz>


> diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
> index 0e64a1b..3657ac1 100644
> --- a/drivers/base/power/clock_ops.c
> +++ b/drivers/base/power/clock_ops.c
> @@ -159,7 +159,7 @@ int of_pm_clk_add_clks(struct device *dev)
>  
>  	count = of_count_phandle_with_args(dev->of_node, "clocks",
>  					   "#clock-cells");
> -	if (count == 0)
> +	if (count <= 0)
>  		return -ENODEV;

Would it make sense to propagate the error value?

									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[toc] | [next] | [standalone]


#1380552

FromColin Ian King <colin.king@canonical.com>
Date2016-04-16 15:50 +0200
Message-ID<royLL-4bu-5@gated-at.bofh.it>
In reply to#1380546
On 16/04/16 13:52, Pavel Machek wrote:
> On Sat 2016-04-16 13:50:03, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> It is entirely possible for of_count_phandle_wit_args to
>> return a -ve error return value so we need to check for this
>> otherwise we end up allocating a negative number of clk objects.
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> 
> Acked-by: Pavel Machek <pavel@ucw.cz>
> 
> 
>> diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
>> index 0e64a1b..3657ac1 100644
>> --- a/drivers/base/power/clock_ops.c
>> +++ b/drivers/base/power/clock_ops.c
>> @@ -159,7 +159,7 @@ int of_pm_clk_add_clks(struct device *dev)
>>  
>>  	count = of_count_phandle_with_args(dev->of_node, "clocks",
>>  					   "#clock-cells");
>> -	if (count == 0)
>> +	if (count <= 0)
>>  		return -ENODEV;
> 
> Would it make sense to propagate the error value?

I don't think it will contribute much more than the current return.

> 
> 									Pavel
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web