From: Alex Elder Date: Fri, 12 Jun 2015 15:21:06 +0000 (-0500) Subject: greybus: connection: remove extra kfree() call X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1470 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=856618f3fb6506f277adf060717590d03d3fb559;p=karo-tx-linux.git greybus: connection: remove extra kfree() call When an error occurs in the device_add() call for a connection, the device reference is dropped as required. Because that's the device's only reference, that will also lead to gb_connection_release() being called, which frees the connection structure. Right now we're then making an extra request to free the connection, which is wrong. Fix that. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index ab6c60ec874c..bf5fa101e541 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -219,7 +219,7 @@ struct gb_connection *gb_connection_create(struct gb_bundle *bundle, gb_connection_hd_cport_id_free(connection); gb_protocol_put(connection->protocol); put_device(&connection->dev); - kfree(connection); + return NULL; }