Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Sean Wang <sean.wang@kernel.org>,
	Linus Walleij <linusw@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Maoguang Meng <maoguang.meng@mediatek.com>,
	Hao Chang <ot_chhao.chang@mediatek.com>,
	Qingliang Li <qingliang.li@mediatek.com>,
	Nicolas Boichat <drinkcat@chromium.org>,
	linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: stable@vger.kernel.org
Subject: [PATCH v2 4/6] pinctrl: mediatek: Guard against NULL eint in mtk_eint_do_suspend() and mtk_eint_do_resume()
Date: Thu, 19 Nov 2026 20:47:19 +0000	[thread overview]
Message-ID: <20261119204748.2558209-5-lee@kernel.org> (raw)
In-Reply-To: <20261119204748.2558209-1-lee@kernel.org>

mtk_paris_pinctrl_probe() treats mtk_build_eint() failure as non-fatal,
logging a warning and completing probe with hw->eint left as NULL
whenever EINT initialisation is skipped or fails.  However, the system
sleep callbacks pass pctl->eint unconditionally to
mtk_eint_do_suspend() and mtk_eint_do_resume(), both of which
dereference eint without checking for NULL.

Return 0 early from mtk_eint_do_suspend() and mtk_eint_do_resume() when
eint is NULL.

Fixes: 5c0904488a20 ("pinctrl: mediatek: Add pm_ops to pinctrl-paris")
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---

v1 => v2:
 - New patch, avoiding a NULL dereference on suspend/resume when EINT
   setup fails (Sashiko)

 drivers/pinctrl/mediatek/mtk-eint.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/pinctrl/mediatek/mtk-eint.c b/drivers/pinctrl/mediatek/mtk-eint.c
index 827231dc0d24..ca47a416c666 100644
--- a/drivers/pinctrl/mediatek/mtk-eint.c
+++ b/drivers/pinctrl/mediatek/mtk-eint.c
@@ -427,6 +427,9 @@ static void mtk_eint_irq_handler(struct irq_desc *desc)
 
 int mtk_eint_do_suspend(struct mtk_eint *eint)
 {
+	if (!eint)
+		return 0;
+
 	mtk_eint_chip_write_mask(eint, eint->wake_mask);
 
 	return 0;
@@ -435,6 +438,9 @@ EXPORT_SYMBOL_GPL(mtk_eint_do_suspend);
 
 int mtk_eint_do_resume(struct mtk_eint *eint)
 {
+	if (!eint)
+		return 0;
+
 	mtk_eint_chip_write_mask(eint, eint->cur_mask);
 
 	return 0;
-- 
2.56.1.750.gf70dc682cf-goog


  parent reply	other threads:[~2026-11-19 20:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 20:47 [PATCH v2 0/6] pinctrl: Fix out-of-bounds accesses, divide-by-zero, and error handling Lee Jones
2026-11-19 20:47 ` [PATCH v2 1/6] pinctrl: tegra186: Fix out-of-bounds register bank index for AON drive groups Lee Jones
2026-11-19 20:47 ` [PATCH v2 2/6] pinctrl: ingenic: Fix element type of x1600_sfc_funcs array Lee Jones
2026-11-19 20:47 ` [PATCH v2 3/6] pinctrl: mediatek: mt7981: Add missing entries to mt7981_ant_sel_funcs Lee Jones
2026-11-19 20:47 ` Lee Jones [this message]
2026-11-19 20:47 ` [PATCH v2 5/6] pinctrl: mediatek: Clean up partially initialised hw->eint on error Lee Jones
2026-11-19 20:47 ` [PATCH v2 6/6] pinctrl: mediatek: Prevent divide-by-zero for pins with fixed drive strength Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119204748.2558209-5-lee@kernel.org \
    --to=lee@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=drinkcat@chromium.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=maoguang.meng@mediatek.com \
    --cc=matthias.bgg@gmail.com \
    --cc=ot_chhao.chang@mediatek.com \
    --cc=qingliang.li@mediatek.com \
    --cc=sean.wang@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox