1
0
Fork 0

greybus: battery: fix panic on operation error

If an operation times out or otherwise returns an error, val->intval
should not be set and an error-code should be returned.

Fixes a panic on unload while receiving -ENOTCONN.

Signed-off-by: Perry Hung <perry@leaflabs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
hifive-unleashed-5.1
Perry Hung 2015-07-24 19:02:29 -04:00 committed by Greg Kroah-Hartman
parent 23119de4e6
commit e619e8505b
1 changed files with 1 additions and 1 deletions

View File

@ -281,7 +281,7 @@ static int get_property(struct power_supply *b,
return -EINVAL;
}
return 0;
return (val->intval < 0) ? val->intval : 0;
}
// FIXME - verify this list, odds are some can be removed and others added.