Re: [PATCH 02/15] ov7670: call v4l2_async_register_subdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/18/16 23:08, Sakari Ailus wrote:
On Mon, Dec 12, 2016 at 04:55:07PM +0100, Hans Verkuil wrote:
From: Hans Verkuil <hans.verkuil@xxxxxxxxx>

Add v4l2-async support for this driver.

Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>
---
 drivers/media/i2c/ov7670.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index b0315bb..3f0522f 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -1641,18 +1641,15 @@ static int ov7670_probe(struct i2c_client *client,
 	if (info->hdl.error) {
 		int err = info->hdl.error;

-		v4l2_ctrl_handler_free(&info->hdl);
-		return err;
+		goto fail;
 	}

 #if defined(CONFIG_MEDIA_CONTROLLER)
 	info->pad.flags = MEDIA_PAD_FL_SOURCE;
 	info->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 	ret = media_entity_pads_init(&info->sd.entity, 1, &info->pad);
-	if (ret < 0) {
-		v4l2_ctrl_handler_free(&info->hdl);
-		return ret;
-	}
+	if (ret < 0)
+		goto fail;
 #endif
 	/*
 	 * We have checked empirically that hw allows to read back the gain
@@ -1664,7 +1661,19 @@ static int ov7670_probe(struct i2c_client *client,
 	v4l2_ctrl_cluster(2, &info->saturation);
 	v4l2_ctrl_handler_setup(&info->hdl);

+	ret = v4l2_async_register_subdev(&info->sd);
+	if (ret < 0) {
+#if defined(CONFIG_MEDIA_CONTROLLER)
+		media_entity_cleanup(&info->sd.entity);

I think it'd be cleaner if you added another label for this. Up to you.

That's better indeed. Added the label.

	Hans


Acked-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>

+#endif
+		goto fail;
+	}
+
 	return 0;
+
+fail:
+	v4l2_ctrl_handler_free(&info->hdl);
+	return ret;
 }




--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux