public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Colin King <colin.king@canonical.com>
Cc: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PM / clk: ensure we don't allocate a -ve size of count clks
Date: Sat, 16 Apr 2016 14:52:35 +0200	[thread overview]
Message-ID: <20160416125235.GB31772@amd> (raw)
In-Reply-To: <1460811003-31806-1-git-send-email-colin.king@canonical.com>

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

  reply	other threads:[~2016-04-16 12:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-16 12:50 [PATCH] PM / clk: ensure we don't allocate a -ve size of count clks Colin King
2016-04-16 12:52 ` Pavel Machek [this message]
2016-04-16 13:49   ` Colin Ian King
2016-04-27 21:36 ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160416125235.GB31772@amd \
    --to=pavel@ucw.cz \
    --cc=colin.king@canonical.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox