25a12d5912257f9d58546a77f5083b7da938fdee
[openwrt/staging/ldir.git] /
1 From 5ff331cb050f52361ec40512cc6d87f4923ed29f Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 31 Mar 2022 12:03:36 +0100
4 Subject: [PATCH] drm/panel: ilitek-ili9881c: Clean up on
5 mipi_dsi_attach failure
6
7 mipi_dsi_attach is allowed to fail, and currently the probe
8 code doesn't clean up (mainly drm_panel_remove) if this happens.
9
10 Add cleanup code on failure.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 ---
14 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 6 +++++-
15 1 file changed, 5 insertions(+), 1 deletion(-)
16
17 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
18 +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
19 @@ -1161,7 +1161,11 @@ static int ili9881c_dsi_probe(struct mip
20 dsi->format = MIPI_DSI_FMT_RGB888;
21 dsi->lanes = 4;
22
23 - return mipi_dsi_attach(dsi);
24 + ret = mipi_dsi_attach(dsi);
25 + if (ret)
26 + drm_panel_remove(&ctx->panel);
27 +
28 + return ret;
29 }
30
31 static void ili9881c_dsi_remove(struct mipi_dsi_device *dsi)