public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Ethan Tidmore <ethantidmore06@gmail.com>
To: Anitha Chrisanthus <anitha.chrisanthus@intel.com>,
	Edmund Dea <edmund.j.dea@intel.com>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: Sam Ravnborg <sam@ravnborg.org>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Ethan Tidmore <ethantidmore06@gmail.com>
Subject: [PATCH] drm/kmb: Fix error pointer dereference
Date: Thu, 19 Feb 2026 16:44:26 -0600	[thread overview]
Message-ID: <20260219224426.1122073-1-ethantidmore06@gmail.com> (raw)

The function kmb_dsi_init() can return an error pointer and is checked
for it, and once confirm here in this code block below, goes to the label
err_free1:

kmb->kmb_dsi = kmb_dsi_init(dsi_pdev);
if (IS_ERR(kmb->kmb_dsi)) {
	drm_err(&kmb->drm, "failed to initialize DSI\n");
	ret = PTR_ERR(kmb->kmb_dsi);
	goto err_free1;
}

At the label itself it dereferences the confirmed error pointer.

 err_free1:
	dev_set_drvdata(dev, NULL);
	kmb_dsi_host_unregister(kmb->kmb_dsi);

	return ret;
}

Add check for error pointer before running kmb_dsi_host_unregister().

Fixes: 7f7b96a8a0a18 ("drm/kmb: Add support for KeemBay Display")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
 drivers/gpu/drm/kmb/kmb_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index 7c2eb1152fc2..9eabbce7574f 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -576,7 +576,8 @@ static int kmb_probe(struct platform_device *pdev)
 	drm_mode_config_cleanup(&kmb->drm);
  err_free1:
 	dev_set_drvdata(dev, NULL);
-	kmb_dsi_host_unregister(kmb->kmb_dsi);
+	if (!IS_ERR(kmb->kmb_dsi))
+		kmb_dsi_host_unregister(kmb->kmb_dsi);
 
 	return ret;
 }
-- 
2.53.0


             reply	other threads:[~2026-02-20  8:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19 22:44 Ethan Tidmore [this message]
2026-02-22 20:12 ` Claude review: drm/kmb: Fix error pointer dereference Claude Code Review Bot
2026-02-22 20:12 ` Claude Code Review Bot

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=20260219224426.1122073-1-ethantidmore06@gmail.com \
    --to=ethantidmore06@gmail.com \
    --cc=airlied@gmail.com \
    --cc=anitha.chrisanthus@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=edmund.j.dea@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=simona@ffwll.ch \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox