MISRA-C:2012, 15.4 - There should be no more than one break or goto statement used to terminate any iteration statement
reshuffle the code to use a single break with no additional tests.
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- src/audio/pipeline.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index a5f7a5d..636a42b 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -526,7 +526,7 @@ static int preload_downstream(struct comp_dev *start, struct comp_dev *current) int pipeline_prepare(struct pipeline *p, struct comp_dev *dev) { struct op_data op_data; - int ret; + int ret = -1; int i;
trace_pipe("pre"); @@ -551,18 +551,15 @@ int pipeline_prepare(struct pipeline *p, struct comp_dev *dev)
ret = preload_downstream(dev, dev);
- /* errors ? */ - if (ret < 0) + /* errors or complete ? */ + if (ret <= 0) break; - /* complete ? */ - else if (ret == 0) - goto out; } - - /* failed to preload */ - trace_pipe_error("epl"); - ret = -EIO; - + if (ret < 0) { + /* failed to preload */ + trace_pipe_error("epl"); + ret = -EIO; + } } else { ret = component_op_upstream(&op_data, dev, dev, NULL); }