mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pinctrl: mediatek: common-v1: Fix EINT breakage on older controllers
@ 2025-04-15 11:23 Chen-Yu Tsai
  2025-04-15 11:37 ` AngeloGioacchino Del Regno
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chen-Yu Tsai @ 2025-04-15 11:23 UTC (permalink / raw)
  To: Sean Wang, Linus Walleij, Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Chen-Yu Tsai, linux-mediatek, linux-gpio, linux-kernel,
	linux-arm-kernel, Uwe Kleine-König, Hao Chang, Qingliang Li

When EINT support for multiple addresses was introduced, the driver
library for the older generations (pinctrl-mtk-common) was not fixed
together. This resulted in invalid pointer accesses.

Fix up the filled in |struct mtk_eint| in pinctrl-mtk-common to match
what is now expected by the mtk-eint library.

Reported-by: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Closes: https://lore.kernel.org/all/43nd5jxpk7b7fv46frqlfjnqfh5jlpqsemeoakqzd4wdi3df6y@w7ycd3k5ezvn/
Fixes: 3ef9f710efcb ("pinctrl: mediatek: Add EINT support for multiple addresses")
Cc: Hao Chang <ot_chhao.chang@mediatek.com>
Cc: Qingliang Li <qingliang.li@mediatek.com>
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Stepped on this today on an MT8173 Chromebook. Thanks goes out to Uwe
for pointing out what was broken.

This should be applied and sent to Torvald's tree ASAP.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 91edb539925a..7585de11854b 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1015,7 +1015,13 @@ static int mtk_eint_init(struct mtk_pinctrl *pctl, struct platform_device *pdev)
 	if (!pctl->eint)
 		return -ENOMEM;
 
-	pctl->eint->base = devm_platform_ioremap_resource(pdev, 0);
+	pctl->eint->nbase = 1;
+	/* mtk-eint expects an array */
+	pctl->eint->base = devm_kzalloc(pctl->dev, sizeof(pctl->eint->base), GFP_KERNEL);
+	if (IS_ERR(pctl->eint->base))
+		return -ENOMEM;
+
+	pctl->eint->base[0] = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pctl->eint->base))
 		return PTR_ERR(pctl->eint->base);
 
-- 
2.49.0.604.gff1f9ca942-goog


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

* Re: [PATCH] pinctrl: mediatek: common-v1: Fix EINT breakage on older controllers
  2025-04-15 11:23 [PATCH] pinctrl: mediatek: common-v1: Fix EINT breakage on older controllers Chen-Yu Tsai
@ 2025-04-15 11:37 ` AngeloGioacchino Del Regno
  2025-04-16  7:29 ` Linus Walleij
  2025-04-16 16:09 ` Uwe Kleine-König
  2 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-15 11:37 UTC (permalink / raw)
  To: Chen-Yu Tsai, Sean Wang, Linus Walleij, Matthias Brugger
  Cc: linux-mediatek, linux-gpio, linux-kernel, linux-arm-kernel,
	Uwe Kleine-König, Hao Chang, Qingliang Li

Il 15/04/25 13:23, Chen-Yu Tsai ha scritto:
> When EINT support for multiple addresses was introduced, the driver
> library for the older generations (pinctrl-mtk-common) was not fixed
> together. This resulted in invalid pointer accesses.
> 
> Fix up the filled in |struct mtk_eint| in pinctrl-mtk-common to match
> what is now expected by the mtk-eint library.
> 
> Reported-by: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
> Closes: https://lore.kernel.org/all/43nd5jxpk7b7fv46frqlfjnqfh5jlpqsemeoakqzd4wdi3df6y@w7ycd3k5ezvn/
> Fixes: 3ef9f710efcb ("pinctrl: mediatek: Add EINT support for multiple addresses")
> Cc: Hao Chang <ot_chhao.chang@mediatek.com>
> Cc: Qingliang Li <qingliang.li@mediatek.com>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


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

* Re: [PATCH] pinctrl: mediatek: common-v1: Fix EINT breakage on older controllers
  2025-04-15 11:23 [PATCH] pinctrl: mediatek: common-v1: Fix EINT breakage on older controllers Chen-Yu Tsai
  2025-04-15 11:37 ` AngeloGioacchino Del Regno
@ 2025-04-16  7:29 ` Linus Walleij
  2025-04-16 16:09 ` Uwe Kleine-König
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2025-04-16  7:29 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Sean Wang, Matthias Brugger, AngeloGioacchino Del Regno,
	linux-mediatek, linux-gpio, linux-kernel, linux-arm-kernel,
	Uwe Kleine-König, Hao Chang, Qingliang Li

On Tue, Apr 15, 2025 at 1:23 PM Chen-Yu Tsai <wenst@chromium.org> wrote:

> When EINT support for multiple addresses was introduced, the driver
> library for the older generations (pinctrl-mtk-common) was not fixed
> together. This resulted in invalid pointer accesses.
>
> Fix up the filled in |struct mtk_eint| in pinctrl-mtk-common to match
> what is now expected by the mtk-eint library.
>
> Reported-by: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
> Closes: https://lore.kernel.org/all/43nd5jxpk7b7fv46frqlfjnqfh5jlpqsemeoakqzd4wdi3df6y@w7ycd3k5ezvn/
> Fixes: 3ef9f710efcb ("pinctrl: mediatek: Add EINT support for multiple addresses")
> Cc: Hao Chang <ot_chhao.chang@mediatek.com>
> Cc: Qingliang Li <qingliang.li@mediatek.com>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

Patch applied for fixes.

Yours,
Linus Walleij

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

* Re: [PATCH] pinctrl: mediatek: common-v1: Fix EINT breakage on older controllers
  2025-04-15 11:23 [PATCH] pinctrl: mediatek: common-v1: Fix EINT breakage on older controllers Chen-Yu Tsai
  2025-04-15 11:37 ` AngeloGioacchino Del Regno
  2025-04-16  7:29 ` Linus Walleij
@ 2025-04-16 16:09 ` Uwe Kleine-König
  2 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2025-04-16 16:09 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Sean Wang, Linus Walleij, Matthias Brugger,
	AngeloGioacchino Del Regno, linux-mediatek, linux-gpio,
	linux-kernel, linux-arm-kernel, Hao Chang, Qingliang Li

[-- Attachment #1: Type: text/plain, Size: 967 bytes --]

On Tue, Apr 15, 2025 at 07:23:37PM +0800, Chen-Yu Tsai wrote:
> When EINT support for multiple addresses was introduced, the driver
> library for the older generations (pinctrl-mtk-common) was not fixed
> together. This resulted in invalid pointer accesses.
> 
> Fix up the filled in |struct mtk_eint| in pinctrl-mtk-common to match
> what is now expected by the mtk-eint library.
> 
> Reported-by: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
> Closes: https://lore.kernel.org/all/43nd5jxpk7b7fv46frqlfjnqfh5jlpqsemeoakqzd4wdi3df6y@w7ycd3k5ezvn/
> Fixes: 3ef9f710efcb ("pinctrl: mediatek: Add EINT support for multiple addresses")
> Cc: Hao Chang <ot_chhao.chang@mediatek.com>
> Cc: Qingliang Li <qingliang.li@mediatek.com>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

I confirm this fixes the booting issue on the mt8365-evk.

If it's not too late for that:

Tested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>

Thanks
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2025-04-16 16:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-15 11:23 [PATCH] pinctrl: mediatek: common-v1: Fix EINT breakage on older controllers Chen-Yu Tsai
2025-04-15 11:37 ` AngeloGioacchino Del Regno
2025-04-16  7:29 ` Linus Walleij
2025-04-16 16:09 ` Uwe Kleine-König

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

all inboxes | Powered by JetHome®