Skip to content

Commit 95ca17b

Browse files
committed
ipc4: handler: Simplify error handling in ipc4_pipeline_prepare
Move the check of the ret variable value after the switch to simplify the code. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent 1391978 commit 95ca17b

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/ipc/ipc4/handler.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,6 @@ int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd)
300300

301301
tr_dbg(&ipc_tr, "pipeline %d: set params", ppl_icd->id);
302302
ret = ipc4_pcm_params(host);
303-
if (ret < 0)
304-
return IPC4_INVALID_REQUEST;
305303
break;
306304
default:
307305
ipc_cmd_err(&ipc_tr,
@@ -315,9 +313,6 @@ int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd)
315313
case COMP_STATE_INIT:
316314
tr_dbg(&ipc_tr, "pipeline %d: reset from init", ppl_icd->id);
317315
ret = ipc4_pipeline_complete(ipc, ppl_icd->id, cmd);
318-
if (ret < 0)
319-
ret = IPC4_INVALID_REQUEST;
320-
321316
break;
322317
case COMP_STATE_READY:
323318
case COMP_STATE_ACTIVE:
@@ -337,9 +332,6 @@ int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd)
337332
case COMP_STATE_INIT:
338333
tr_dbg(&ipc_tr, "pipeline %d: pause from init", ppl_icd->id);
339334
ret = ipc4_pipeline_complete(ipc, ppl_icd->id, cmd);
340-
if (ret < 0)
341-
ret = IPC4_INVALID_REQUEST;
342-
343335
break;
344336
default:
345337
/* No action needed */
@@ -360,6 +352,8 @@ int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd)
360352
return IPC4_INVALID_REQUEST;
361353
}
362354

355+
if (ret < 0)
356+
return IPC4_INVALID_REQUEST;
363357
return ret;
364358
}
365359

0 commit comments

Comments
 (0)