Skip to contentSkip to conversation

drm/vc4: platform_get_irq_byname() returns an int

PATCH In review Greg Kroah-Hartman 2 participants 2 messages Feb 23 – Mar 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vc4: platform_get_irq_byname() returns an int

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 <[email protected]>
Cc Dave Stevenson <[email protected]>
Cc "Maíra Canal" <[email protected]>
Cc Raspberry Pi Kernel Maintenance <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc David Airlie <[email protected]>
Cc Simona Vetter <[email protected]>
Cc stable <[email protected]>
Assisted-by gkh_clanker_2000
---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +9 -4
index fda214b5a466..ac1c484c8a89 100644
@@ -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);
Signature · 1 line
2.53.0
reviewer
#1 lore raw
Quoted 5 lines · Greg Kroah-Hartman

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