[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKohpok+_wee9HwvQqpn7HRj_9zH3EifNn0MX_1yXx=WJuK0RQ@mail.gmail.com>
Date: Wed, 17 Dec 2014 09:58:17 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Dmitry Torokhov <dtor@...omium.org>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Stefan Wahren <stefan.wahren@...e.com>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
Nishanth Menon <nm@...com>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/4] PM / OPP: fix warning in of_free_opp_table
On 17 December 2014 at 04:39, Dmitry Torokhov <dtor@...omium.org> wrote:
> Not having OPP defined for a device is not a crime, we should not splat
> warning in this case. Also, it seems that we are ready to accept invalid
> dev (find_device_opp will return ERR_PTR(-EINVAL) then) so let's not
> crash in dev_name() in such case.
>
> Signed-off-by: Dmitry Torokhov <dtor@...omium.org>
> ---
> drivers/base/power/opp.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
> index b78c14d..413c7fe 100644
> --- a/drivers/base/power/opp.c
> +++ b/drivers/base/power/opp.c
> @@ -799,9 +799,15 @@ void of_free_opp_table(struct device *dev)
>
> /* Check for existing list for 'dev' */
> dev_opp = find_device_opp(dev);
> - if (WARN(IS_ERR(dev_opp), "%s: dev_opp: %ld\n", dev_name(dev),
> - PTR_ERR(dev_opp)))
> + if (IS_ERR(dev_opp)) {
> + int error = PTR_ERR(dev_opp);
> + if (error != -ENODEV)
> + WARN(1, "%s: dev_opp: %ld\n",
> + IS_ERR_OR_NULL(dev) ?
> + "Invalid device" : dev_name(dev),
> + error);
> return;
What about this:
if (IS_ERR(dev_opp)) {
int error = PTR_ERR(dev_opp);
WARN(error != -ENODEV, "%s: dev_opp: %ld\n",
IS_ERR_OR_NULL(dev) ? "Invalid device" : dev_name(dev),
error);
return;
}
We can get rid of the extra indentation level and an extra comparison check.
Otherwise:
Acked-by: Viresh Kumar <viresh.kumar@...aro.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists