From: Laurent Pinchart Date: Sun, 3 Nov 2013 23:28:24 +0000 (-0300) Subject: [media] v4l: omap4iss: Simplify error paths X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=2b16b44a1c44814ed00cf750d20f3c404b5d4e48;p=openwrt%2Fstaging%2Fblogic.git [media] v4l: omap4iss: Simplify error paths Get rid of a goto statement for a simple error path that can be inlined, and split spaghetti error code to a separate section. Signed-off-by: Laurent Pinchart Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c index 7d427d541fd3..b7c8a6bc7d80 100644 --- a/drivers/staging/media/omap4iss/iss.c +++ b/drivers/staging/media/omap4iss/iss.c @@ -887,24 +887,22 @@ void omap4iss_isp_subclk_disable(struct iss_device *iss, */ static int iss_enable_clocks(struct iss_device *iss) { - int r; + int ret; - r = clk_enable(iss->iss_fck); - if (r) { + ret = clk_enable(iss->iss_fck); + if (ret) { dev_err(iss->dev, "clk_enable iss_fck failed\n"); - return r; + return ret; } - r = clk_enable(iss->iss_ctrlclk); - if (r) { + ret = clk_enable(iss->iss_ctrlclk); + if (ret) { dev_err(iss->dev, "clk_enable iss_ctrlclk failed\n"); - goto out_clk_enable_ctrlclk; + clk_disable(iss->iss_fck); + return ret; } - return 0; -out_clk_enable_ctrlclk: - clk_disable(iss->iss_fck); - return r; + return 0; } /* diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c index ccbdecd0114c..a527330abc34 100644 --- a/drivers/staging/media/omap4iss/iss_video.c +++ b/drivers/staging/media/omap4iss/iss_video.c @@ -826,16 +826,17 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) spin_unlock_irqrestore(&video->qlock, flags); } - if (ret < 0) { + mutex_unlock(&video->stream_lock); + return 0; + err_omap4iss_set_stream: - vb2_streamoff(&vfh->queue, type); + vb2_streamoff(&vfh->queue, type); err_iss_video_check_format: - media_entity_pipeline_stop(&video->video.entity); + media_entity_pipeline_stop(&video->video.entity); err_media_entity_pipeline_start: - if (video->iss->pdata->set_constraints) - video->iss->pdata->set_constraints(video->iss, false); - video->queue = NULL; - } + if (video->iss->pdata->set_constraints) + video->iss->pdata->set_constraints(video->iss, false); + video->queue = NULL; mutex_unlock(&video->stream_lock); return ret;