提交 3809f839 编写于 作者: B Brian Norris 提交者: Zheng Zengkai

drm/panel: innolux-p079zca: Delete panel on attach() failure

stable inclusion
from stable-v5.10.94
commit 9bc19022aa08a1c0f30780df0275c4ee77a1ca2c
bugzilla: https://gitee.com/openeuler/kernel/issues/I531X9

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=9bc19022aa08a1c0f30780df0275c4ee77a1ca2c

--------------------------------

[ Upstream commit 32a267e9 ]

If we fail to attach (e.g., because 1 of 2 dual-DSI controllers aren't
ready), we leave a dangling drm_panel reference to freed memory. Clean
that up on failure.

This problem exists since the driver's introduction, but is especially
relevant after refactored for dual-DSI variants.

Fixes: 14c8f2e9 ("drm/panel: add Innolux P079ZCA panel driver")
Fixes: 7ad4e463 ("drm/panel: p079zca: Refactor panel driver to support multiple panels")
Signed-off-by: NBrian Norris <briannorris@chromium.org>
Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210923173336.2.I9023cf8811a3abf4964ed84eb681721d8bb489d6@changeidSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 0f0252d7
......@@ -484,6 +484,7 @@ static void innolux_panel_del(struct innolux_panel *innolux)
static int innolux_panel_probe(struct mipi_dsi_device *dsi)
{
const struct panel_desc *desc;
struct innolux_panel *innolux;
int err;
desc = of_device_get_match_data(&dsi->dev);
......@@ -495,7 +496,14 @@ static int innolux_panel_probe(struct mipi_dsi_device *dsi)
if (err < 0)
return err;
return mipi_dsi_attach(dsi);
err = mipi_dsi_attach(dsi);
if (err < 0) {
innolux = mipi_dsi_get_drvdata(dsi);
innolux_panel_del(innolux);
return err;
}
return 0;
}
static int innolux_panel_remove(struct mipi_dsi_device *dsi)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册