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>
This commit is contained in:
parent
23119de4e6
commit
e619e8505b
|
@ -281,7 +281,7 @@ static int get_property(struct power_supply *b,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return (val->intval < 0) ? val->intval : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME - verify this list, odds are some can be removed and others added.
|
// FIXME - verify this list, odds are some can be removed and others added.
|
||||||
|
|
Loading…
Reference in a new issue