staging: vchiq_arm: make vchiq_get_state return early

Make vchiq_get_state return early with NULL and improve the readability.

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-16-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Stefan Wahren 2022-01-23 21:02:20 +01:00 committed by Greg Kroah-Hartman
parent 96225b631c
commit 914813cc52
1 changed files with 8 additions and 4 deletions

View File

@ -1285,14 +1285,18 @@ int vchiq_dump_platform_service_state(void *dump_context,
struct vchiq_state *
vchiq_get_state(void)
{
if (!g_state.remote)
if (!g_state.remote) {
pr_err("%s: g_state.remote == NULL\n", __func__);
else if (g_state.remote->initialised != 1)
return NULL;
}
if (g_state.remote->initialised != 1) {
pr_notice("%s: g_state.remote->initialised != 1 (%d)\n",
__func__, g_state.remote->initialised);
return NULL;
}
return (g_state.remote &&
(g_state.remote->initialised == 1)) ? &g_state : NULL;
return &g_state;
}
/*