[media] v4l: omap4iss: Simplify error paths
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 3 Nov 2013 23:28:24 +0000 (20:28 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 3 Dec 2013 19:53:02 +0000 (17:53 -0200)
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 <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/staging/media/omap4iss/iss.c
drivers/staging/media/omap4iss/iss_video.c

index 7d427d541fd3c8025ee06ccff8781220e4712b2c..b7c8a6bc7d804509d91e379e945bff0fd3c6b6cc 100644 (file)
@@ -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;
 }
 
 /*
index ccbdecd0114cf6cb42e75db595811ae5a4050809..a527330abc34a8ccc67f1a59292d6d4ab5d32eba 100644 (file)
@@ -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;