greybus: battery: free struct on error in caller
When a battery connection is initialized, a gb_battery structure for
it is allocated in gb_battery_connection_init(). Currently that
function ends by calling init_and_register(); in the event an error
occurs, init_and_register() is responsible for freeing the allocated
gb_battery structure.
Make the code a bit better balanced by having the function that
allocates the structure be responsible for freeing it in case of
error.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>