greybus: operation: clean up create-incoming error path
authorJohan Hovold <johan@hovoldconsulting.com>
Tue, 14 Jul 2015 13:43:24 +0000 (15:43 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 15 Jul 2015 19:39:13 +0000 (12:39 -0700)
Clean up gb_operation_create_incoming error path by returning
immediately on allocation failures.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/operation.c

index 41aec7647b2b12eda72e5ed6a2aa4e68e790ac45..081694c8a1c27eec0554069001ab6e0d05cdcd97 100644 (file)
@@ -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;
 }