summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorStefan Wahren <stefan.wahren@i2se.com>2021-04-11 20:11:40 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-12 11:41:22 +0200
commitf2f560e1bdc055a6a306e6b7823ba589794e6564 (patch)
treef210df051b9ebe3b288b0e5f2e128a044af93eba /drivers/staging
parentfa80183c5513528ad21be719f761cc505ef43949 (diff)
downloadlinux-f2f560e1bdc055a6a306e6b7823ba589794e6564.tar.bz2
staging: vchiq_core: split exit conditions
Some exit conditions are rather complex. So better split them up. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1618164700-21150-11-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index f5bd5e2a41fa..517a8c9b41ed 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -3069,9 +3069,16 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle,
enum vchiq_status status = VCHIQ_ERROR;
int payload[2];
- if (!service || service->srvstate != VCHIQ_SRVSTATE_OPEN ||
- (!offset && !uoffset) ||
- vchiq_check_service(service) != VCHIQ_SUCCESS)
+ if (!service)
+ goto error_exit;
+
+ if (service->srvstate != VCHIQ_SRVSTATE_OPEN)
+ goto error_exit;
+
+ if (!offset && !uoffset)
+ goto error_exit;
+
+ if (vchiq_check_service(service) != VCHIQ_SUCCESS)
goto error_exit;
switch (mode) {
@@ -3215,8 +3222,10 @@ vchiq_queue_message(unsigned int handle,
struct vchiq_service *service = find_service_by_handle(handle);
enum vchiq_status status = VCHIQ_ERROR;
- if (!service ||
- (vchiq_check_service(service) != VCHIQ_SUCCESS))
+ if (!service)
+ goto error_exit;
+
+ if (vchiq_check_service(service) != VCHIQ_SUCCESS)
goto error_exit;
if (!size) {
@@ -3327,10 +3336,15 @@ vchiq_get_peer_version(unsigned int handle, short *peer_version)
enum vchiq_status status = VCHIQ_ERROR;
struct vchiq_service *service = find_service_by_handle(handle);
- if (!service ||
- (vchiq_check_service(service) != VCHIQ_SUCCESS) ||
- !peer_version)
+ if (!service)
+ goto exit;
+
+ if (vchiq_check_service(service) != VCHIQ_SUCCESS)
+ goto exit;
+
+ if (!peer_version)
goto exit;
+
*peer_version = service->peer_version;
status = VCHIQ_SUCCESS;