Commit 6edf6156 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Robert Foss

drm/bridge: sn65dsi83: Fix an error handling path in sn65dsi83_probe()

sn65dsi83_parse_dt() takes a reference on 'ctx->host_node' that must be
released in the error handling path of this function and of the probe.
This is only done in the remove function up to now.

Fixes: ceb515ba ("drm/bridge: ti-sn65dsi83: Add TI SN65DSI83 and SN65DSI84 driver")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarRobert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/4bc21aed4b60d3d5ac4b28d8b07a6fdd8da6a536.1640768126.git.christophe.jaillet@wanadoo.fr
parent 6844a288
...@@ -573,10 +573,14 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model) ...@@ -573,10 +573,14 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
ctx->host_node = of_graph_get_remote_port_parent(endpoint); ctx->host_node = of_graph_get_remote_port_parent(endpoint);
of_node_put(endpoint); of_node_put(endpoint);
if (ctx->dsi_lanes < 0 || ctx->dsi_lanes > 4) if (ctx->dsi_lanes < 0 || ctx->dsi_lanes > 4) {
return -EINVAL; ret = -EINVAL;
if (!ctx->host_node) goto err_put_node;
return -ENODEV; }
if (!ctx->host_node) {
ret = -ENODEV;
goto err_put_node;
}
ctx->lvds_dual_link = false; ctx->lvds_dual_link = false;
ctx->lvds_dual_link_even_odd_swap = false; ctx->lvds_dual_link_even_odd_swap = false;
...@@ -603,11 +607,13 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model) ...@@ -603,11 +607,13 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
ret = drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &panel, &panel_bridge); ret = drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &panel, &panel_bridge);
if (ret < 0) if (ret < 0)
return ret; goto err_put_node;
if (panel) { if (panel) {
panel_bridge = devm_drm_panel_bridge_add(dev, panel); panel_bridge = devm_drm_panel_bridge_add(dev, panel);
if (IS_ERR(panel_bridge)) if (IS_ERR(panel_bridge)) {
return PTR_ERR(panel_bridge); ret = PTR_ERR(panel_bridge);
goto err_put_node;
}
} }
ctx->panel_bridge = panel_bridge; ctx->panel_bridge = panel_bridge;
...@@ -618,6 +624,10 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model) ...@@ -618,6 +624,10 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
"Failed to get supply 'vcc'\n"); "Failed to get supply 'vcc'\n");
return 0; return 0;
err_put_node:
of_node_put(ctx->host_node);
return ret;
} }
static int sn65dsi83_host_attach(struct sn65dsi83 *ctx) static int sn65dsi83_host_attach(struct sn65dsi83 *ctx)
...@@ -692,8 +702,10 @@ static int sn65dsi83_probe(struct i2c_client *client, ...@@ -692,8 +702,10 @@ static int sn65dsi83_probe(struct i2c_client *client,
return ret; return ret;
ctx->regmap = devm_regmap_init_i2c(client, &sn65dsi83_regmap_config); ctx->regmap = devm_regmap_init_i2c(client, &sn65dsi83_regmap_config);
if (IS_ERR(ctx->regmap)) if (IS_ERR(ctx->regmap)) {
return PTR_ERR(ctx->regmap); ret = PTR_ERR(ctx->regmap);
goto err_put_node;
}
dev_set_drvdata(dev, ctx); dev_set_drvdata(dev, ctx);
i2c_set_clientdata(client, ctx); i2c_set_clientdata(client, ctx);
...@@ -710,6 +722,8 @@ static int sn65dsi83_probe(struct i2c_client *client, ...@@ -710,6 +722,8 @@ static int sn65dsi83_probe(struct i2c_client *client,
err_remove_bridge: err_remove_bridge:
drm_bridge_remove(&ctx->bridge); drm_bridge_remove(&ctx->bridge);
err_put_node:
of_node_put(ctx->host_node);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment