All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: Sam Ravnborg <sam@ravnborg.org>,
	Thierry Reding <thierry.reding@gmail.com>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Heiko Stuebner <heiko@sntech.de>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	Jagan Teki <jagan@amarulasolutions.com>,
	Brian Norris <briannorris@chromium.org>
Subject: [PATCH 1/3] drm/panel: kingdisplay-kd097d04: Delete panel on attach() failure
Date: Thu, 23 Sep 2021 17:33:53 -0700	[thread overview]
Message-ID: <20210923173336.1.Icb4d9dbc1817f4e826361a4f1cea7461541668f0@changeid> (raw)
In-Reply-To: <20210924003355.2071543-1-briannorris@chromium.org>

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.

Fixes: 2a994cbed6b2 ("drm/panel: Add Kingdisplay KD097D04 panel driver")
Signed-off-by: Brian Norris <briannorris@chromium.org>
---

 drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
index 86e4213e8bb1..daccb1fd5fda 100644
--- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
+++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
@@ -406,7 +406,13 @@ static int kingdisplay_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) {
+		kingdisplay_panel_del(kingdisplay);
+		return err;
+	}
+
+	return 0;
 }
 
 static int kingdisplay_panel_remove(struct mipi_dsi_device *dsi)
-- 
2.33.0.685.g46640cef36-goog


  reply	other threads:[~2021-09-24  0:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-24  0:33 [PATCH 0/3] drm/panel: Proper cleanup after mipi_dsi_attach() Brian Norris
2021-09-24  0:33 ` Brian Norris [this message]
2021-09-24  0:33 ` [PATCH 2/3] drm/panel: innolux-p079zca: Delete panel on attach() failure Brian Norris
2021-09-24  0:33 ` [PATCH 3/3] drm/panel: Delete panel on mipi_dsi_attach() failure Brian Norris
2021-10-14 19:59 ` [PATCH 0/3] drm/panel: Proper cleanup after mipi_dsi_attach() Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210923173336.1.Icb4d9dbc1817f4e826361a4f1cea7461541668f0@changeid \
    --to=briannorris@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=jagan@amarulasolutions.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=sumit.semwal@linaro.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.