staging: vchiq_dev: Avoid unnecessary alloc in vchiq_ioc_create_service
authorStefan Wahren <stefan.wahren@i2se.com>
Sun, 23 Jan 2022 20:02:23 +0000 (21:02 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Jan 2022 15:30:16 +0000 (16:30 +0100)
commite12592158515831e5ff6e80a36a4d05ceaf22908
tree41c8dae9a35a52904e19216e2f390862d6c25edf
parentca225857faf237234d2fffe5d1919467dfadd822
staging: vchiq_dev: Avoid unnecessary alloc in vchiq_ioc_create_service

There is no need to allocate the user service in case there is a VCHIQ
connection required, but not available. So simply check the error conditions
before doing an expensive memory allocation.

Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1642968143-19281-19-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c