Skip to content

Commit

Permalink
PM / OPP: fix warning in of_free_opp_table()
Browse files Browse the repository at this point in the history
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@chromium.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Dmitry Torokhov authored and Rafael J. Wysocki committed Dec 18, 2014
1 parent b02ded2 commit 0fe30da
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/base/power/opp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: %d\n",
IS_ERR_OR_NULL(dev) ?
"Invalid device" : dev_name(dev),
error);
return;
}

/* Hold our list modification lock here */
mutex_lock(&dev_opp_list_lock);
Expand Down

0 comments on commit 0fe30da

Please sign in to comment.