From 856618f3fb6506f277adf060717590d03d3fb559 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Fri, 12 Jun 2015 10:21:06 -0500 Subject: [PATCH] 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 --- drivers/staging/greybus/connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.39.2