* [PATCH next] drm/mediatek: Fix platform_get_irq() error checking
@ 2025-11-25 13:52 Dan Carpenter
2025-12-30 15:41 ` Chun-Kuang Hu
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-11-25 13:52 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Simona Vetter,
Matthias Brugger, CK Hu, Louis-Alexis Eyraud, dri-devel,
linux-mediatek, linux-kernel, linux-arm-kernel, kernel-janitors
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.
Fixes: 8d0f79886273 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
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(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
index e78eb0876f16..bd7f8c56ec9c 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
@@ -303,7 +303,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, struct platform_device
return 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);
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.h b/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
index de5e064585f8..7a644bbf5843 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
@@ -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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH next] drm/mediatek: Fix platform_get_irq() error checking
2025-11-25 13:52 [PATCH next] drm/mediatek: Fix platform_get_irq() error checking Dan Carpenter
@ 2025-12-30 15:41 ` Chun-Kuang Hu
0 siblings, 0 replies; 2+ messages in thread
From: Chun-Kuang Hu @ 2025-12-30 15:41 UTC (permalink / raw)
To: Dan Carpenter
Cc: AngeloGioacchino Del Regno, Chun-Kuang Hu, Philipp Zabel,
David Airlie, Simona Vetter, Matthias Brugger, CK Hu,
Louis-Alexis Eyraud, dri-devel, linux-mediatek, linux-kernel,
linux-arm-kernel, kernel-janitors
Hi, Dan:
Dan Carpenter <dan.carpenter@linaro.org> 於 2025年11月25日週二 下午1:52寫道:
>
> 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.
>
> Fixes: 8d0f79886273 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
> index e78eb0876f16..bd7f8c56ec9c 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
> @@ -303,7 +303,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, struct platform_device
> return 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);
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.h b/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
> index de5e064585f8..7a644bbf5843 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
> @@ -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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-30 15:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-25 13:52 [PATCH next] drm/mediatek: Fix platform_get_irq() error checking Dan Carpenter
2025-12-30 15:41 ` Chun-Kuang Hu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).