public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/vc4: platform_get_irq_byname() returns an int
@ 2026-02-23 15:53 Greg Kroah-Hartman
  2026-02-24  0:07 ` Claude review: " Claude Code Review Bot
  2026-02-24  0:07 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-02-23 15:53 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-kernel, Greg Kroah-Hartman, Maxime Ripard, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	stable

platform_get_irq_byname() will return a negative value if an error
happens, so it should be checked and not just passed directly into
devm_request_threaded_irq() hoping all will be ok.

Cc: Maxime Ripard <mripard@kernel.org>
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>
Cc: "Maíra Canal" <mcanal@igalia.com>
Cc: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: stable <stable@kernel.org>
Assisted-by: gkh_clanker_2000
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index fda214b5a466..ac1c484c8a89 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -2449,17 +2449,22 @@ static int vc4_hdmi_hotplug_init(struct vc4_hdmi *vc4_hdmi)
 	int ret;
 
 	if (vc4_hdmi->variant->external_irq_controller) {
-		unsigned int hpd_con = platform_get_irq_byname(pdev, "hpd-connected");
-		unsigned int hpd_rm = platform_get_irq_byname(pdev, "hpd-removed");
+		int hpd = platform_get_irq_byname(pdev, "hpd-connected");
+		if (hpd < 0)
+			return hpd;
 
-		ret = devm_request_threaded_irq(&pdev->dev, hpd_con,
+		ret = devm_request_threaded_irq(&pdev->dev, hpd,
 						NULL,
 						vc4_hdmi_hpd_irq_thread, IRQF_ONESHOT,
 						"vc4 hdmi hpd connected", vc4_hdmi);
 		if (ret)
 			return ret;
 
-		ret = devm_request_threaded_irq(&pdev->dev, hpd_rm,
+		hpd = platform_get_irq_byname(pdev, "hpd-removed");
+		if (hpd < 0)
+			return hpd;
+
+		ret = devm_request_threaded_irq(&pdev->dev, hpd,
 						NULL,
 						vc4_hdmi_hpd_irq_thread, IRQF_ONESHOT,
 						"vc4 hdmi hpd disconnected", vc4_hdmi);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Claude review: drm/vc4: platform_get_irq_byname() returns an int
  2026-02-23 15:53 [PATCH] drm/vc4: platform_get_irq_byname() returns an int Greg Kroah-Hartman
@ 2026-02-24  0:07 ` Claude Code Review Bot
  2026-02-24  0:07 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-02-24  0:07 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/vc4: platform_get_irq_byname() returns an int
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Patches: 1
Reviewed: 2026-02-24T10:07:38.188288

---

This is a single-patch fix from Greg Kroah-Hartman correcting the return type handling of `platform_get_irq_byname()` in the vc4 HDMI driver. The original code stored the return value in `unsigned int` variables, which silently converted negative error codes into large positive values that would then be passed to `devm_request_threaded_irq()`. The fix changes the type to `int` and adds proper error checking before each use.

The fix is correct and well-structured. The caller at `vc4_hdmi_bind()` already checks the return value of `vc4_hdmi_hotplug_init()` and handles errors appropriately. No issues found.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Claude review: drm/vc4: platform_get_irq_byname() returns an int
  2026-02-23 15:53 [PATCH] drm/vc4: platform_get_irq_byname() returns an int Greg Kroah-Hartman
  2026-02-24  0:07 ` Claude review: " Claude Code Review Bot
@ 2026-02-24  0:07 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-02-24  0:07 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

The original code declared the IRQ numbers as `unsigned int`:

> -		unsigned int hpd_con = platform_get_irq_byname(pdev, "hpd-connected");
> -		unsigned int hpd_rm = platform_get_irq_byname(pdev, "hpd-removed");

`platform_get_irq_byname()` returns `int` and uses negative values for errors. Storing into `unsigned int` makes the error check impossible and passes a bogus large IRQ number to `devm_request_threaded_irq()`, which would likely fail with `-EINVAL` anyway, but with a confusing error message from the IRQ subsystem rather than a clear error from the platform lookup.

The fix consolidates to a single `int hpd` variable, checking each result before use:

> +		int hpd = platform_get_irq_byname(pdev, "hpd-connected");
> +		if (hpd < 0)
> +			return hpd;
> ...
> +		hpd = platform_get_irq_byname(pdev, "hpd-removed");
> +		if (hpd < 0)
> +			return hpd;

The variable reuse is fine since the first IRQ number is fully consumed by `devm_request_threaded_irq()` before the variable is reassigned for the second lookup. The caller in `vc4_hdmi_bind()` checks the return value and jumps to `err_put_runtime_pm`, which handles cleanup correctly.

No issues found. Straightforward and correct fix.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-24  0:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 15:53 [PATCH] drm/vc4: platform_get_irq_byname() returns an int Greg Kroah-Hartman
2026-02-24  0:07 ` Claude review: " Claude Code Review Bot
2026-02-24  0:07 ` Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox