greybus: battery: fix panic on operation error
authorPerry Hung <perry@leaflabs.com>
Fri, 24 Jul 2015 23:02:29 +0000 (19:02 -0400)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 24 Jul 2015 23:39:58 +0000 (16:39 -0700)
commite619e8505b66229fdf2735ac00891d340111b0a8
tree2674bb328c9fd3d7939cd6ef66f91bcba510b045
parent23119de4e69c8a96f10de4bcc62d3751e7d77eb4
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>
drivers/staging/greybus/battery.c