Commit 41ba8bd0 authored by Jan H. Schönherr's avatar Jan H. Schönherr Committed by Rafael J. Wysocki

PM / QoS: Use the correct variable to check the QoS request type

Use the actual function argument for the validation of the request type,
instead of the type field in a fresh (supposedly zero-initialized)
request structure.
Signed-off-by: default avatarJan H. Schönherr <jschoenh@amazon.de>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 2bd6bf03
...@@ -277,11 +277,11 @@ void dev_pm_qos_constraints_destroy(struct device *dev) ...@@ -277,11 +277,11 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
mutex_unlock(&dev_pm_qos_sysfs_mtx); mutex_unlock(&dev_pm_qos_sysfs_mtx);
} }
static bool dev_pm_qos_invalid_request(struct device *dev, static bool dev_pm_qos_invalid_req_type(struct device *dev,
struct dev_pm_qos_request *req) enum dev_pm_qos_req_type type)
{ {
return !req || (req->type == DEV_PM_QOS_LATENCY_TOLERANCE return type == DEV_PM_QOS_LATENCY_TOLERANCE &&
&& !dev->power.set_latency_tolerance); !dev->power.set_latency_tolerance;
} }
static int __dev_pm_qos_add_request(struct device *dev, static int __dev_pm_qos_add_request(struct device *dev,
...@@ -290,7 +290,7 @@ static int __dev_pm_qos_add_request(struct device *dev, ...@@ -290,7 +290,7 @@ static int __dev_pm_qos_add_request(struct device *dev,
{ {
int ret = 0; int ret = 0;
if (!dev || dev_pm_qos_invalid_request(dev, req)) if (!dev || !req || dev_pm_qos_invalid_req_type(dev, type))
return -EINVAL; return -EINVAL;
if (WARN(dev_pm_qos_request_active(req), if (WARN(dev_pm_qos_request_active(req),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment