From: Guennadi Liakhovetski Date: Fri, 23 Nov 2012 19:55:06 +0000 (+0100) Subject: PM / QoS: fix wrong error-checking condition X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a7227a0faa117d0bc532aea546ae5ac5f89e8ed7;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git PM / QoS: fix wrong error-checking condition 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 Cc: Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 74a67e0019a..fbbd4ed2edf 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -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;