From 9a586bd2bb80a268345cc8ccfa702413359ece06 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Tue, 14 Jul 2015 15:43:24 +0200 Subject: [PATCH] greybus: operation: clean up create-incoming error path Clean up gb_operation_create_incoming error path by returning immediately on allocation failures. Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/operation.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 41aec7647b2b..081694c8a1c2 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -511,10 +511,11 @@ gb_operation_create_incoming(struct gb_connection *connection, u16 id, operation = gb_operation_create_common(connection, type, request_size, 0, flags, GFP_ATOMIC); - if (operation) { - operation->id = id; - memcpy(operation->request->header, data, size); - } + if (!operation) + return NULL; + + operation->id = id; + memcpy(operation->request->header, data, size); return operation; }