Skip to content

Commit 41ba8bd

Browse files
schnhrrrafaeljw
authored andcommitted
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: Jan H. Schönherr <jschoenh@amazon.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 2bd6bf0 commit 41ba8bd

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎drivers/base/power/qos.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
277277
mutex_unlock(&dev_pm_qos_sysfs_mtx);
278278
}
279279

280-
static bool dev_pm_qos_invalid_request(struct device *dev,
281-
struct dev_pm_qos_request *req)
280+
static bool dev_pm_qos_invalid_req_type(struct device *dev,
281+
enum dev_pm_qos_req_type type)
282282
{
283-
return !req || (req->type == DEV_PM_QOS_LATENCY_TOLERANCE
284-
&& !dev->power.set_latency_tolerance);
283+
return type == DEV_PM_QOS_LATENCY_TOLERANCE &&
284+
!dev->power.set_latency_tolerance;
285285
}
286286

287287
static int __dev_pm_qos_add_request(struct device *dev,
@@ -290,7 +290,7 @@ static int __dev_pm_qos_add_request(struct device *dev,
290290
{
291291
int ret = 0;
292292

293-
if (!dev || dev_pm_qos_invalid_request(dev, req))
293+
if (!dev || !req || dev_pm_qos_invalid_req_type(dev, type))
294294
return -EINVAL;
295295

296296
if (WARN(dev_pm_qos_request_active(req),

0 commit comments

Comments
 (0)