From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: devel@driverdev.osuosl.org,
Sergio Aguirre <sergio.a.aguirre@gmail.com>,
Sakari Ailus <sakari.ailus@iki.fi>,
linux-media@vger.kernel.org
Subject: Re: [PATCH 2/6] v4l: omap4iss: Add support for OMAP4 camera interface - Video devices
Date: Mon, 04 Nov 2013 00:52:25 +0100 [thread overview]
Message-ID: <2459922.55JmYbL2g9@avalon> (raw)
In-Reply-To: <20131004081638.GA6192@mwanda>
Hi Dan,
Thank you for the comments.
On Friday 04 October 2013 11:16:38 Dan Carpenter wrote:
> On Thu, Oct 03, 2013 at 01:55:29AM +0200, Laurent Pinchart wrote:
> > +
> > + ret = vb2_streamon(&vfh->queue, type);
> > + if (ret < 0)
> > + goto err_iss_video_check_format;
> > +
> > + /* In sensor-to-memory mode, the stream can be started synchronously
> > + * to the stream on command. In memory-to-memory mode, it will be
> > + * started when buffers are queued on both the input and output.
> > + */
> > + if (pipe->input == NULL) {
> > + unsigned long flags;
> > + ret = omap4iss_pipeline_set_stream(pipe,
> > + ISS_PIPELINE_STREAM_CONTINUOUS);
> > + if (ret < 0)
> > + goto err_omap4iss_set_stream;
> > + spin_lock_irqsave(&video->qlock, flags);
> > + if (list_empty(&video->dmaqueue))
> > + video->dmaqueue_flags |= ISS_VIDEO_DMAQUEUE_UNDERRUN;
> > + spin_unlock_irqrestore(&video->qlock, flags);
> > + }
> > +
> > + if (ret < 0) {
> > +err_omap4iss_set_stream:
> > + vb2_streamoff(&vfh->queue, type);
> > +err_iss_video_check_format:
> > + 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 (!ret)
> > + video->streaming = 1;
> > +
> > + mutex_unlock(&video->stream_lock);
> > + return ret;
> > +}
>
> This driver is mostly really nice code, but this error handling is
> spaghetti-al-nasty. Just split up the success and failure returns.
>
> video->streaming = 1;
> mutex_unlock(&video->stream_lock);
> return 0;
>
> err_omap4iss_set_stream:
> vb2_streamoff(&vfh->queue, type);
> err_iss_video_check_format:
> 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;
>
> mutex_unlock(&video->stream_lock);
> return ret;
> }
Sure, I'll fix that.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2013-11-03 23:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-02 23:55 [PATCH 0/6] OMAP4 ISS driver Laurent Pinchart
2013-10-02 23:55 ` [PATCH 1/6] v4l: omap4iss: Add support for OMAP4 camera interface - Core Laurent Pinchart
2013-10-03 6:40 ` Hans Verkuil
2013-10-05 21:49 ` Sakari Ailus
2013-11-03 23:43 ` Laurent Pinchart
2013-10-17 12:48 ` Mauro Carvalho Chehab
2013-10-17 13:10 ` Laurent Pinchart
2013-10-02 23:55 ` [PATCH 2/6] v4l: omap4iss: Add support for OMAP4 camera interface - Video devices Laurent Pinchart
2013-10-03 6:54 ` Hans Verkuil
2013-11-03 23:28 ` Laurent Pinchart
2013-11-04 8:34 ` Hans Verkuil
2013-11-05 3:23 ` Laurent Pinchart
2013-10-04 8:16 ` Dan Carpenter
2013-11-03 23:52 ` Laurent Pinchart [this message]
2013-10-02 23:55 ` [PATCH 3/6] v4l: omap4iss: Add support for OMAP4 camera interface - CSI receivers Laurent Pinchart
2013-10-02 23:55 ` [PATCH 4/6] v4l: omap4iss: Add support for OMAP4 camera interface - IPIPE(IF) Laurent Pinchart
2013-10-02 23:55 ` [PATCH 5/6] v4l: omap4iss: Add support for OMAP4 camera interface - Resizer Laurent Pinchart
2013-10-02 23:55 ` [PATCH 6/6] v4l: omap4iss: Add support for OMAP4 camera interface - Build system Laurent Pinchart
2013-10-03 7:00 ` [PATCH 0/6] OMAP4 ISS driver Hans Verkuil
2013-10-03 9:28 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2459922.55JmYbL2g9@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@iki.fi \
--cc=sergio.a.aguirre@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.