drm/mediatek: Fix platform_get_irq() error checking
Subsystems (4)
PATCH 1/1 drm/mediatek: Fix platform_get_irq() error checking
The platform_get_irq() function returns negative error codes on failure and positive non-zero IRQ numbers on success. It never returns NULL. Fix the error checking to look for negatives, and change "hdmi->irq" from unsigned int to just int.
--- drivers/gpu/drm/mediatek/mtk_hdmi_common.c | 2 +- drivers/gpu/drm/mediatek/mtk_hdmi_common.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_hdmi_common.c +1 -1
@@ -303,7 +303,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, struct platform_devicereturn dev_err_probe (dev, ret,"Failed to get clocks\n" ); hdmi->irq =platform_get_irq (pdev,0 ); -if (!hdmi->irq) +if (hdmi->irq <0 )return hdmi->irq; hdmi->regs =device_node_to_regmap (dev->of_node);
drivers/gpu/drm/mediatek/mtk_hdmi_common.h +1 -1
@@ -168,7 +168,7 @@ struct mtk_hdmi {bool audio_enable;bool powered;bool enabled; -unsigned int irq; +int irq;enum hdmi_hpd_state hpd;hdmi_codec_plugged_cb plugged_cb;struct device *codec_dev;
Signature · 1 line
2.51.0
Hi, Dan:
Dan Carpenter <[email protected]> 於 2025年11月25日週二 下午1:52寫道:
Quoted 5 lines
The
platform_get_irq()function returns negative error codes on failure and positive non-zero IRQ numbers on success. It never returns NULL. Fix the error checking to look for negatives, and change "hdmi->irq" from unsigned int to just int.
Applied to mediatek-drm-fixes [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-fixes
Regards,
Chun-Kuang.
Quoted 37 lines
Fixes 8d0f79886273 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188")Signed-off-by Dan Carpenter <[email protected]>--- drivers/gpu/drm/mediatek/mtk_hdmi_common.c | 2 +- drivers/gpu/drm/mediatek/mtk_hdmi_common.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/mediatek/mtk_hdmi_common.c +1
-1@@ -303,7 +303,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, struct platform_devicereturn dev_err_probe (dev, ret,"Failed to get clocks\n" ); hdmi->irq =platform_get_irq (pdev,0 ); -if (!hdmi->irq) +if (hdmi->irq <0 )return hdmi->irq; hdmi->regs =device_node_to_regmap (dev->of_node);drivers/gpu/drm/mediatek/mtk_hdmi_common.h +1
-2@@ -168,7 +168,7 @@ struct mtk_hdmi {bool audio_enable;bool powered;bool enabled; -unsigned int irq; +int irq;enum hdmi_hpd_state hpd;hdmi_codec_plugged_cb plugged_cb;struct device *codec_dev; --2.51.0