Commit e619e850 authored by Perry Hung's avatar Perry Hung Committed by Greg Kroah-Hartman

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: default avatarPerry Hung <perry@leaflabs.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 23119de4
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment