Skip to content

Commit

Permalink
Input: bma150 - fix checking pm_runtime_get_sync() return value
Browse files Browse the repository at this point in the history
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@amarulasolutions.com>
Signed-off-by: Antonio Ospite <ao2@amarulasolutions.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Michael Trimarchi authored and Dmitry Torokhov committed Feb 16, 2013
1 parent cd40120 commit 79f34d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/input/misc/bma150.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand Down

0 comments on commit 79f34d1

Please sign in to comment.