Re: [PATCH v5 15/17] media: platform: Switch to v4l2_async_notifier_add_subdev

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

 



Hi Sakari,


On 07/02/2018 04:23 AM, Sakari Ailus wrote:
On Fri, Jun 29, 2018 at 11:49:59AM -0700, Steve Longerbeam wrote:
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index a96f53c..8464ceb 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1553,7 +1553,7 @@ vpif_capture_get_pdata(struct platform_device *pdev)
  					    sizeof(*chan->inputs),
  					    GFP_KERNEL);
  		if (!chan->inputs)
-			return NULL;
+			goto err_cleanup;
chan->input_count++;
  		chan->inputs[i].input.type = V4L2_INPUT_TYPE_CAMERA;
@@ -1587,28 +1587,30 @@ vpif_capture_get_pdata(struct platform_device *pdev)
  			rem->name, rem);
  		sdinfo->name = rem->full_name;
- pdata->asd[i] = devm_kzalloc(&pdev->dev,
-					     sizeof(struct v4l2_async_subdev),
-					     GFP_KERNEL);
-		if (!pdata->asd[i]) {
+		pdata->asd[i] = v4l2_async_notifier_add_fwnode_subdev(
+			&vpif_obj.notifier, of_fwnode_handle(rem),
+			sizeof(struct v4l2_async_subdev));
+		if (IS_ERR(pdata->asd[i])) {
  			of_node_put(rem);
-			pdata = NULL;
-			goto done;
+			goto err_cleanup;
  		}
- pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
-		pdata->asd[i]->match.fwnode = of_fwnode_handle(rem);
-		of_node_put(rem);
+		of_node_put(endpoint);
You end up putting the same endpoint twice in the successful case.

One way to address that would be to get the OF node's remote port parent
(i.e. the device) immediately so you can forget OF node use counts in error
handling.


Thanks for catching. I ended up doing what you suggested, moved the get
of remote port parent to just after getting local endpoint node, and removed
node puts in the done and cleanup paths, in vpif_capture_get_pdata().

Steve




[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