* [PATCH 1/2] drm/bridge: th1520-dw-hdmi: Fix error check on dw_hdmi_probe() return value
2026-03-20 19:12 [PATCH 0/2] drm/bridge: th1520-dw-hdmi: Two fixes Felix Gu
@ 2026-03-20 19:12 ` Felix Gu
2026-03-21 17:24 ` Claude review: " Claude Code Review Bot
2026-03-20 19:12 ` [PATCH 2/2] drm/bridge: th1520-dw-hdmi: Fix remove() callback Felix Gu
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Felix Gu @ 2026-03-20 19:12 UTC (permalink / raw)
To: Drew Fustini, Guo Ren, Fu Wei, Andrzej Hajda, Neil Armstrong,
Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Icenowy Zheng
Cc: linux-riscv, dri-devel, linux-kernel, Felix Gu
The error check after calling dw_hdmi_probe() was incorrectly checking
the struct pointer hdmi instead of the probe result hdmi->dw_hdmi.
Fix this by checking the correct variable.
Fixes: 96f30ee0fb9d ("drm/bridge: add a driver for T-Head TH1520 HDMI controller")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/gpu/drm/bridge/th1520-dw-hdmi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/th1520-dw-hdmi.c b/drivers/gpu/drm/bridge/th1520-dw-hdmi.c
index 389eead5f1c4..c9968ec1823c 100644
--- a/drivers/gpu/drm/bridge/th1520-dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/th1520-dw-hdmi.c
@@ -136,8 +136,8 @@ static int th1520_dw_hdmi_probe(struct platform_device *pdev)
plat_data->priv_data = hdmi;
hdmi->dw_hdmi = dw_hdmi_probe(pdev, plat_data);
- if (IS_ERR(hdmi))
- return PTR_ERR(hdmi);
+ if (IS_ERR(hdmi->dw_hdmi))
+ return PTR_ERR(hdmi->dw_hdmi);
platform_set_drvdata(pdev, hdmi);
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Claude review: drm/bridge: th1520-dw-hdmi: Fix error check on dw_hdmi_probe() return value
2026-03-20 19:12 ` [PATCH 1/2] drm/bridge: th1520-dw-hdmi: Fix error check on dw_hdmi_probe() return value Felix Gu
@ 2026-03-21 17:24 ` Claude Code Review Bot
0 siblings, 0 replies; 7+ messages in thread
From: Claude Code Review Bot @ 2026-03-21 17:24 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Verdict: Correct, good fix.**
The original code was:
```c
hdmi->dw_hdmi = dw_hdmi_probe(pdev, plat_data);
if (IS_ERR(hdmi))
return PTR_ERR(hdmi);
```
This is wrong because `hdmi` is the `struct th1520_hdmi *` allocated earlier via `devm_kzalloc()` — it's always a valid kernel pointer, never an ERR_PTR. The error encoding from `dw_hdmi_probe()` is stored in `hdmi->dw_hdmi`, so `IS_ERR(hdmi)` would always be false, causing the driver to silently proceed with an error pointer stored in `hdmi->dw_hdmi`, leading to crashes later.
The fix correctly checks `hdmi->dw_hdmi`:
```c
if (IS_ERR(hdmi->dw_hdmi))
return PTR_ERR(hdmi->dw_hdmi);
```
No issues. Fixes tag and commit message are accurate.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] drm/bridge: th1520-dw-hdmi: Fix remove() callback
2026-03-20 19:12 [PATCH 0/2] drm/bridge: th1520-dw-hdmi: Two fixes Felix Gu
2026-03-20 19:12 ` [PATCH 1/2] drm/bridge: th1520-dw-hdmi: Fix error check on dw_hdmi_probe() return value Felix Gu
@ 2026-03-20 19:12 ` Felix Gu
2026-03-21 17:24 ` Claude review: " Claude Code Review Bot
2026-03-21 5:05 ` [PATCH 0/2] drm/bridge: th1520-dw-hdmi: Two fixes Icenowy Zheng
2026-03-21 17:24 ` Claude review: " Claude Code Review Bot
3 siblings, 1 reply; 7+ messages in thread
From: Felix Gu @ 2026-03-20 19:12 UTC (permalink / raw)
To: Drew Fustini, Guo Ren, Fu Wei, Andrzej Hajda, Neil Armstrong,
Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Icenowy Zheng
Cc: linux-riscv, dri-devel, linux-kernel, Felix Gu
This driver stores struct th1520_hdmi * in platform drvdata, but
th1520_dw_hdmi_remove() was reading it back as struct dw_hdmi *
and passing it to dw_hdmi_remove(), so teardown runs on the wrong
pointer.
Retrieve struct th1520_hdmi * from platform drvdata and pass
hdmi->dw_hdmi to dw_hdmi_remove().
Fixes: 96f30ee0fb9d ("drm/bridge: add a driver for T-Head TH1520 HDMI controller")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/gpu/drm/bridge/th1520-dw-hdmi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/th1520-dw-hdmi.c b/drivers/gpu/drm/bridge/th1520-dw-hdmi.c
index c9968ec1823c..6ec9003a8f3f 100644
--- a/drivers/gpu/drm/bridge/th1520-dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/th1520-dw-hdmi.c
@@ -146,9 +146,9 @@ static int th1520_dw_hdmi_probe(struct platform_device *pdev)
static void th1520_dw_hdmi_remove(struct platform_device *pdev)
{
- struct dw_hdmi *hdmi = platform_get_drvdata(pdev);
+ struct th1520_hdmi *hdmi = platform_get_drvdata(pdev);
- dw_hdmi_remove(hdmi);
+ dw_hdmi_remove(hdmi->dw_hdmi);
}
static const struct of_device_id th1520_dw_hdmi_of_table[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Claude review: drm/bridge: th1520-dw-hdmi: Fix remove() callback
2026-03-20 19:12 ` [PATCH 2/2] drm/bridge: th1520-dw-hdmi: Fix remove() callback Felix Gu
@ 2026-03-21 17:24 ` Claude Code Review Bot
0 siblings, 0 replies; 7+ messages in thread
From: Claude Code Review Bot @ 2026-03-21 17:24 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Verdict: Correct, good fix.**
The original code was:
```c
struct dw_hdmi *hdmi = platform_get_drvdata(pdev);
dw_hdmi_remove(hdmi);
```
But `platform_set_drvdata(pdev, hdmi)` in probe stores a `struct th1520_hdmi *`, not a `struct dw_hdmi *`. Casting the wrong type to `struct dw_hdmi *` and passing it to `dw_hdmi_remove()` would result in operating on garbage data — likely memory corruption or a crash on module removal.
The fix correctly retrieves the proper type and dereferences the inner pointer:
```c
struct th1520_hdmi *hdmi = platform_get_drvdata(pdev);
dw_hdmi_remove(hdmi->dw_hdmi);
```
No issues. Both patches are straightforward, well-described, and suitable for merge.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] drm/bridge: th1520-dw-hdmi: Two fixes
2026-03-20 19:12 [PATCH 0/2] drm/bridge: th1520-dw-hdmi: Two fixes Felix Gu
2026-03-20 19:12 ` [PATCH 1/2] drm/bridge: th1520-dw-hdmi: Fix error check on dw_hdmi_probe() return value Felix Gu
2026-03-20 19:12 ` [PATCH 2/2] drm/bridge: th1520-dw-hdmi: Fix remove() callback Felix Gu
@ 2026-03-21 5:05 ` Icenowy Zheng
2026-03-21 17:24 ` Claude review: " Claude Code Review Bot
3 siblings, 0 replies; 7+ messages in thread
From: Icenowy Zheng @ 2026-03-21 5:05 UTC (permalink / raw)
To: Felix Gu, Drew Fustini, Guo Ren, Fu Wei, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: linux-riscv, dri-devel, linux-kernel
在 2026-03-21六的 03:12 +0800,Felix Gu写道:
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
> Felix Gu (2):
> drm/bridge: th1520-dw-hdmi: Fix error check on dw_hdmi_probe()
> return value
> drm/bridge: th1520-dw-hdmi: Fix remove() callback
Both fixes look trivial and let me start to doubt how could I make such
mistakes.
Reviewed-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
>
> drivers/gpu/drm/bridge/th1520-dw-hdmi.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
> ---
> base-commit: b5d083a3ed1e2798396d5e491432e887da8d4a06
> change-id: 20260321-th1520-f4326138c9bf
>
> Best regards,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Claude review: drm/bridge: th1520-dw-hdmi: Two fixes
2026-03-20 19:12 [PATCH 0/2] drm/bridge: th1520-dw-hdmi: Two fixes Felix Gu
` (2 preceding siblings ...)
2026-03-21 5:05 ` [PATCH 0/2] drm/bridge: th1520-dw-hdmi: Two fixes Icenowy Zheng
@ 2026-03-21 17:24 ` Claude Code Review Bot
3 siblings, 0 replies; 7+ messages in thread
From: Claude Code Review Bot @ 2026-03-21 17:24 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/bridge: th1520-dw-hdmi: Two fixes
Author: Felix Gu <ustc.gu@gmail.com>
Patches: 4
Reviewed: 2026-03-22T03:24:58.260762
---
This is a clean, correct 2-patch bugfix series for the T-Head TH1520 DW-HDMI bridge driver. Both patches fix real bugs introduced in the original driver commit (`96f30ee0fb9d`). The fixes are minimal, obvious, and correct. The series is ready to merge with appropriate Fixes tags and should be considered for stable backport.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 7+ messages in thread