Skip to contentSkip to conversation

drm/bridge: anx7625: Return -EPROBE_DEFER if the dsi host was not found

PATCH Applied owen 2 participants 2 messages Jan 17, 2022

Subsystems (3)
lore
Share & tools
lore

owen

author
#0 lore raw

PATCH v5 1/1 drm/bridge: anx7625: Return -EPROBE_DEFER if the dsi host was not found

From: owen <[email protected]>

It will connect to the mipi dsi host and find the corresponding mipi dsi host node, but the node registered by the mipi dsi host has not been loaded yet. of_find_mipi_dsi_host_by_node() returns -EINVAL which causes the calling driver to fail.

If the anx7625 driver is loaded afterwards the driver requesting the mipi dsi host will not notice this.

Better approach is to return -EPROBE_DEFER in such case. Then when the anx7625 driver appears the driver requesting the mipi dsi host will be probed again.

---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +1 -1
index 2346dbcc505f..297bbeb5aae0 100644
@@ -1660,7 +1660,7 @@ static int anx7625_attach_dsi(struct anx7625_data *ctx)
 	host = of_find_mipi_dsi_host_by_node(ctx->pdata.mipi_host_node);
 	if (!host) {
 		DRM_DEV_ERROR(dev, "fail to find dsi host.\n");
-		return -EINVAL;
+		return -EPROBE_DEFER;
 	}
 
 	dsi = devm_mipi_dsi_device_register_full(dev, host, &info);
Signature · 1 line
2.31.0
Reviewed-by on v5 1/1 Applied
#1 lore raw

Hi Owen

Quoted 34 lines · owen

From: owen <[email protected]>

It will connect to the mipi dsi host and find the corresponding mipi dsi host node, but the node registered by the mipi dsi host has not been loaded yet. of_find_mipi_dsi_host_by_node() returns -EINVAL which causes the calling driver to fail.

If the anx7625 driver is loaded afterwards the driver requesting the mipi dsi host will not notice this.

Better approach is to return -EPROBE_DEFER in such case. Then when the anx7625 driver appears the driver requesting the mipi dsi host will be probed again.

---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +1 -2
index 2346dbcc505f..297bbeb5aae0 100644
@@ -1660,7 +1660,7 @@ static int anx7625_attach_dsi(struct anx7625_data *ctx)
        host = of_find_mipi_dsi_host_by_node(ctx->pdata.mipi_host_node);
        if (!host) {
                DRM_DEV_ERROR(dev, "fail to find dsi host.\n");
-               return -EINVAL;
+               return -EPROBE_DEFER;
        }
 
        dsi = devm_mipi_dsi_device_register_full(dev, host, &info);
--
Quoted 2 lines

2.31.0

Applied to drm-misc-next.