ipc: (cosmetic) simplify a conditional statement

Rearrange a conditional to reduce the number of branches and
eliminate a goto.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2019-03-05 12:46:02 +01:00 committed by Liam Girdwood
parent e450244835
commit 96b3b06640
1 changed files with 8 additions and 13 deletions

View File

@ -145,22 +145,17 @@ void ipc_platform_do_cmd(struct ipc *ipc)
/* perform command and return any error */ /* perform command and return any error */
err = ipc_cmd(); err = ipc_cmd();
if (err > 0) {
goto done; /* reply created and copied by cmd() */ /* if err > 0, reply created and copied by cmd() */
} else if (err < 0) { if (err <= 0) {
/* send std error reply */ /* send std error/ok reply */
reply.error = err; reply.error = err;
} else if (err == 0) {
/* send std reply */ reply.hdr.cmd = SOF_IPC_GLB_REPLY;
reply.error = 0; reply.hdr.size = sizeof(reply);
mailbox_hostbox_write(0, &reply, sizeof(reply));
} }
/* send std error/ok reply */
reply.hdr.cmd = SOF_IPC_GLB_REPLY;
reply.hdr.size = sizeof(reply);
mailbox_hostbox_write(0, &reply, sizeof(reply));
done:
ipc->host_pending = 0; ipc->host_pending = 0;
/* are we about to enter D3 ? */ /* are we about to enter D3 ? */