Hi Bjorn

Thanks for the comment.

Yes, I will move of_node_put(dsi1) to right after of_find_mipi_dsi_host_by_node and remove it from err_dsi_device.

Thanks

Abhinav
On 2018-09-20 09:54, Bjorn Andersson wrote:
On Wed 19 Sep 19:55 PDT 2018, Abhinav Kumar wrote:
+static int truly_nt35597_probe(struct mipi_dsi_device *dsi)
+{
[..]
+       dsi1 = of_graph_get_remote_node(dsi->dev.of_node, 1, -1);
+       if (!dsi1) {
+               DRM_DEV_ERROR(dev,
+                       "failed to get remote node for dsi1_device\n");
+               ret = -ENODEV;
+               goto err_get_remote;
+       }
+
+       dsi1_host = of_find_mipi_dsi_host_by_node(dsi1);
+       if (!dsi1_host) {
+               DRM_DEV_ERROR(dev, "failed to find dsi host\n");
+               ret = -EPROBE_DEFER;
+               goto err_host;
+       }
+
+       of_node_put(dsi1);
+
+       /* register the second DSI device */
+       dsi1_device = mipi_dsi_device_register_full(dsi1_host, &info);
+       if (IS_ERR(dsi1_device)) {
[..]
+               goto err_dsi_device;
[..]
+               if (ret < 0) {
+                       DRM_DEV_ERROR(dev,
+                               "dsi attach failed i = %d\n", i);
+                               goto err_dsi_attach;
+               }
+       }
+
+       return 0;
+
+err_dsi_attach:
+       drm_panel_remove(&ctx->panel);
+err_panel_add:
+       mipi_dsi_device_unregister(dsi1_device);
+err_dsi_device:
+err_host:
+       of_node_put(dsi1);

dsi1 is already put if we came here through err_dsi_device et al.

You don't need to reference dsi1 beyond the call to
of_find_mipi_dsi_host_by_node() to put it before checking the dsi1_host.

+err_get_remote:
+       return ret;
+}

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

Reply via email to