diff mbox

[1/2] PM / QoS: Fix check for invalid request

Message ID 1471959827-19837-1-git-send-email-ahaslam@baylibre.com (mailing list archive)
State Deferred
Headers show

Commit Message

Axel Haslam Aug. 23, 2016, 1:43 p.m. UTC
From: Axel Haslam <ahaslam@baylibre.com>

The check for a invalid request is using the "type" member
of the request pointer which is not yet set when this function
is called at the start of __dev_pm_qos_add_request.

Fix this by passing a type directly, and not the request
pointer.

Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
---
 drivers/base/power/qos.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 7f3646e..0bd03e6 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -291,9 +291,9 @@  void dev_pm_qos_constraints_destroy(struct device *dev)
 }
 
 static bool dev_pm_qos_invalid_request(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);
 }
 
@@ -303,7 +303,7 @@  static int __dev_pm_qos_add_request(struct device *dev,
 {
 	int ret = 0;
 
-	if (!dev || dev_pm_qos_invalid_request(dev, req))
+	if (!dev || !req || dev_pm_qos_invalid_request(dev, type))
 		return -EINVAL;
 
 	if (WARN(dev_pm_qos_request_active(req),