Skip to content

Commit

Permalink
PM / QoS: fix wrong error-checking condition
Browse files Browse the repository at this point in the history
dev_pm_qos_add_request() can return 0, 1, or a negative error code,
therefore the correct error test is "if (error < 0)." Checking just for
non-zero return code leads to erroneous setting of the req->dev pointer
to NULL, which then leads to a repeated call to
dev_pm_qos_add_ancestor_request() in st1232_ts_irq_handler(). This in turn
leads to an Oops, when the I2C host adapter is unloaded and reloaded again
because of the inconsistent state of its QoS request list.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
Cc: <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
lyakh authored and rafaeljw committed Nov 23, 2012
1 parent f4a75d2 commit a7227a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/base/power/qos.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ int dev_pm_qos_add_ancestor_request(struct device *dev,
if (ancestor)
error = dev_pm_qos_add_request(ancestor, req, value);

if (error)
if (error < 0)
req->dev = NULL;

return error;
Expand Down

0 comments on commit a7227a0

Please sign in to comment.