dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jan Luebbe <jlu@pengutronix.de>
To: dri-devel@lists.freedesktop.org
Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>,
	Jan Luebbe <jlu@pengutronix.de>
Subject: [PATCH 1/2] gpu: ipu-v3: csi: pass back mbus_code_to_bus_cfg error codes
Date: Thu,  3 May 2018 18:29:36 +0200	[thread overview]
Message-ID: <20180503162937.9788-2-jlu@pengutronix.de> (raw)
In-Reply-To: <20180503162937.9788-1-jlu@pengutronix.de>

From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>

mbus_code_to_bus_cfg() can fail on unknown mbus codes; pass back the
error to the caller.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
 drivers/gpu/ipu-v3/ipu-csi.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c
index caa05b0702e1..39c3aabb6d17 100644
--- a/drivers/gpu/ipu-v3/ipu-csi.c
+++ b/drivers/gpu/ipu-v3/ipu-csi.c
@@ -318,13 +318,17 @@ static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code)
 /*
  * Fill a CSI bus config struct from mbus_config and mbus_framefmt.
  */
-static void fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
+static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
 				 struct v4l2_mbus_config *mbus_cfg,
 				 struct v4l2_mbus_framefmt *mbus_fmt)
 {
+	int rc;
+
 	memset(csicfg, 0, sizeof(*csicfg));
 
-	mbus_code_to_bus_cfg(csicfg, mbus_fmt->code);
+	rc = mbus_code_to_bus_cfg(csicfg, mbus_fmt->code);
+	if (rc < 0)
+		return rc;
 
 	switch (mbus_cfg->type) {
 	case V4L2_MBUS_PARALLEL:
@@ -355,6 +359,8 @@ static void fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
 		/* will never get here, keep compiler quiet */
 		break;
 	}
+
+	return 0;
 }
 
 int ipu_csi_init_interface(struct ipu_csi *csi,
@@ -364,8 +370,11 @@ int ipu_csi_init_interface(struct ipu_csi *csi,
 	struct ipu_csi_bus_config cfg;
 	unsigned long flags;
 	u32 width, height, data = 0;
+	int rc;
 
-	fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt);
+	rc = fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt);
+	if (rc < 0)
+		return rc;
 
 	/* set default sensor frame width and height */
 	width = mbus_fmt->width;
@@ -586,11 +595,14 @@ int ipu_csi_set_mipi_datatype(struct ipu_csi *csi, u32 vc,
 	struct ipu_csi_bus_config cfg;
 	unsigned long flags;
 	u32 temp;
+	int rc;
 
 	if (vc > 3)
 		return -EINVAL;
 
-	mbus_code_to_bus_cfg(&cfg, mbus_fmt->code);
+	rc = mbus_code_to_bus_cfg(&cfg, mbus_fmt->code);
+	if (rc < 0)
+		return rc;
 
 	spin_lock_irqsave(&csi->lock, flags);
 
-- 
2.17.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-05-03 16:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 16:29 [PATCH 0/2] gpu: ipu-v3: csi: add RGB565 support Jan Luebbe
2018-05-03 16:29 ` Jan Luebbe [this message]
2018-05-03 16:29 ` [PATCH 2/2] gpu: ipu-v3: csi: support RGB565 on parallel bus Jan Luebbe
2018-05-18 16:07 ` [PATCH 0/2] gpu: ipu-v3: csi: add RGB565 support Philipp Zabel

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=20180503162937.9788-2-jlu@pengutronix.de \
    --to=jlu@pengutronix.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=enrico.scholz@sigma-chemnitz.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).