[PATCH] drm/vc4: platform_get_irq_byname() returns an int

Greg Kroah-Hartman posted 1 patch 1 month, 1 week ago
drivers/gpu/drm/vc4/vc4_hdmi.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
[PATCH] drm/vc4: platform_get_irq_byname() returns an int
Posted by Greg Kroah-Hartman 1 month, 1 week ago
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

Re: [PATCH] drm/vc4: platform_get_irq_byname() returns an int
Posted by Maíra Canal 1 month ago
On Mon, 23 Feb 2026 16:53:39 +0100, Greg Kroah-Hartman wrote:
> 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.
> 
> 

Applied after adding a blank line after declaration (checkpatch warning), thanks!

[1/1] drm/vc4: platform_get_irq_byname() returns an int
      commit: e597a809a2b97e927060ba182f58eb3e6101bc70

Best regards,
- Maíra