[PATCH 1/2] Input: misc/bma150.c, fix checking pm_runtime_get_sync() return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michael Trimarchi <michael@xxxxxxxxxxxxxxxxxxxx>

When PM_RUNTIME is not defined, pm_runtime_get_sync() returns 1, see
include/linux/pm_runtime.c::__pm_runtime_resume(), and the check of the
return value was overlooking this, in this case bma150_open() would
return 1 which is not expected by upper layers.

Maybe the check for != -ENOSYS (Function not implemented) was meant to
cover this, but pm_runtime_get_sync() does not return this value.

For now fix the issue locally by checking explicitly for negative return
values.

Signed-off-by: Michael Trimarchi <michael@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Antonio Ospite <ao2@xxxxxxxxxxxxxxxxxxxx>
---
 drivers/input/misc/bma150.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c
index 08ffcab..e5d1894 100644
--- a/drivers/input/misc/bma150.c
+++ b/drivers/input/misc/bma150.c
@@ -372,7 +372,7 @@ static int bma150_open(struct bma150_data *bma150)
 	int error;
 
 	error = pm_runtime_get_sync(&bma150->client->dev);
-	if (error && error != -ENOSYS)
+	if (error < 0 && error != -ENOSYS)
 		return error;
 
 	/*
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux