All of
 help / color / mirror / Atom feed
From: Jonathan Cameron <>
To: Laurent Pinchart <>,
	Linux Media Mailing List <>
Subject: Error routes through omap3isp ccdc.
Date: Mon, 11 Jul 2011 11:41:49 +0100	[thread overview]
Message-ID: <> (raw)

Hi All,

Came across this when my camera driver failed to load..

Following causes a kernel panic.

Set up link between cdcc and ccdc output to memory.
(at this point intitializing a capture gives an invalid
arguement error which is fine.)

Now set the format on ISP CCDC/0 to SGRBG10 752x480 (doubt what these
settings are actually matters).  Actually come to think of it, this
may only be relevant as otherwise, the format of my attempted stream
setup from userspace doesn't matter.

Blithely attempt to grab frames from userspace off the ccdc output.
(note it has no input.)

Null pointer exception occurs because:

pad = media_entity_remote_source(&ccdc->pads[CCDC_PAD_SINK]);
static void ccdc_configure(struct isp_ccdc_device *ccdc)

returns null and this is not checked.

Obvious local fix is to check the value of pad and allow ccdc_configure
to return an error + pass this up out of ccdc_set_stream.

Something like the following does the trick.
(not sure error code is right choice!)

Patch is against todays linux-next + a few unconnected things to make
that tree actually build for the beagle xm.

Grep isn't indicating any exactly matching cases to this problem, so
the rest of the tree may be fine.

 [PATCH] omap3isp: check if there is actually a source for ispccdc when
 setting up the link.

Without this if no source actually exists and the ccdc is configured
to output to memory, a read from userspace will cause a null pointer

Signed-off-by: Jonathan Cameron <>
 drivers/media/video/omap3isp/ispccdc.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c
index 6766247..2703a94 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -1110,7 +1110,7 @@ static const u32 ccdc_sgbrg_pattern =
-static void ccdc_configure(struct isp_ccdc_device *ccdc)
+static int ccdc_configure(struct isp_ccdc_device *ccdc)
 	struct isp_device *isp = to_isp_device(ccdc);
 	struct isp_parallel_platform_data *pdata = NULL;
@@ -1127,6 +1127,8 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
 	u32 ccdc_pattern;
 	pad = media_entity_remote_source(&ccdc->pads[CCDC_PAD_SINK]);
+	if (pad == NULL)
+		return -ENODEV;
 	sensor = media_entity_to_v4l2_subdev(pad->entity);
 	if (ccdc->input == CCDC_INPUT_PARALLEL)
 		pdata = &((struct isp_v4l2_subdevs_group *)sensor->host_priv)
@@ -1257,6 +1259,7 @@ unlock:
 	spin_unlock_irqrestore(&ccdc->lsc.req_lock, flags);
+	return 0;
 static void __ccdc_enable(struct isp_ccdc_device *ccdc, int enable)
@@ -1726,7 +1729,9 @@ static int ccdc_set_stream(struct v4l2_subdev *sd, int enable)
 		isp_reg_set(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_CFG,
-		ccdc_configure(ccdc);
+		ret = ccdc_configure(ccdc);
+		if (ret < 0)
+			return ret;
 		/* TODO: Don't configure the video port if all of its output
 		 * links are inactive.

             reply	other threads:[~2011-07-11 10:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11 10:41 Jonathan Cameron [this message]
2011-07-11 10:54 ` Error routes through omap3isp ccdc Laurent Pinchart
2011-07-11 10:57   ` Laurent Pinchart
2011-07-11 11:16     ` Jonathan Cameron
2011-07-31 15:15       ` 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* 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.