From: Chaoyi Chen <kernel@airkyi.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Sandy Huang <hjc@rock-chips.com>,
Andy Yan <andy.yan@rock-chips.com>,
Heiko Stuebner <heiko@sntech.de>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-rockchip@lists.infradead.org,
Chaoyi Chen <chaoyi.chen@rock-chips.com>
Subject: [PATCH] drm/mipi-dsi: Only remove child devices that match the dsi device type
Date: Wed, 3 Dec 2025 19:50:28 +0800 [thread overview]
Message-ID: <20251203115028.133-1-kernel@airkyi.com> (raw)
From: Chaoyi Chen <chaoyi.chen@rock-chips.com>
This patch checks whether the device is a valid mipi_dsi_device before
accessing it in mipi_dsi_remove_device_fn().
The mipi_dsi_host_unregister() assumes that all child devices of the
host device are mipi_dsi_devices and uses mipi_dsi_remove_device_fn()
to perform subsequent operations specific to mipi_dsi_device.
In rockchip platform, for dw-mipi-dsi-rockchip.c, it creates a dphy
device, and it use the dsi host device as its parent device.
And when we call dw_mipi_dsi_remove() in
dw_mipi_dsi_rockchip_remove(), mipi_dsi_host_unregister() will get
such a dphy child device and treat it as an mipi_dsi_device, which
will lead to a further panic.
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
---
drivers/gpu/drm/drm_mipi_dsi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index a712e177b350..5b9cc799eb87 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -349,7 +349,12 @@ EXPORT_SYMBOL(mipi_dsi_host_register);
static int mipi_dsi_remove_device_fn(struct device *dev, void *priv)
{
- struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
+ struct mipi_dsi_device *dsi;
+
+ if (!dev_is_mipi_dsi(dev))
+ return 0;
+
+ dsi = to_mipi_dsi_device(dev);
if (dsi->attached)
mipi_dsi_detach(dsi);
--
2.51.1
next reply other threads:[~2025-12-03 11:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-03 11:50 Chaoyi Chen [this message]
2026-01-07 12:18 ` [PATCH] drm/mipi-dsi: Only remove child devices that match the dsi device type Heiko Stübner
2026-04-13 3:19 ` Chaoyi Chen
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=20251203115028.133-1-kernel@airkyi.com \
--to=kernel@airkyi.com \
--cc=airlied@gmail.com \
--cc=andy.yan@rock-chips.com \
--cc=chaoyi.chen@rock-chips.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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