Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…l/git/mzx/devfreq into pm-devfreq

Pull devfreq updates for v4.16 from MyungJoo Ham

* 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/mzx/devfreq:
  PM / devfreq: Fix potential NULL pointer dereference in governor_store
  PM / devfreq: Propagate error from devfreq_add_device()
  • Loading branch information
Rafael J. Wysocki committed Jan 2, 2018
2 parents 30a7acd + 63f1e05 commit 18065be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/devfreq/devfreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ struct devfreq *devm_devfreq_add_device(struct device *dev,
devfreq = devfreq_add_device(dev, profile, governor_name, data);
if (IS_ERR(devfreq)) {
devres_free(ptr);
return ERR_PTR(-ENOMEM);
return devfreq;
}

*ptr = devfreq;
Expand Down Expand Up @@ -996,7 +996,8 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
if (df->governor == governor) {
ret = 0;
goto out;
} else if (df->governor->immutable || governor->immutable) {
} else if ((df->governor && df->governor->immutable) ||
governor->immutable) {
ret = -EINVAL;
goto out;
}
Expand Down

0 comments on commit 18065be

Please sign in to comment.