* [PATCH 00/10] rtc: assorted bug fixes across RTC drivers
@ 2026-11-23 19:59 Lee Jones
2026-11-23 19:59 ` [PATCH 02/10] rtc: mt6397: handle non-DT platform device matching in probe Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Lee Jones @ 2026-11-23 19:59 UTC (permalink / raw)
To: lee, Matthias Brugger, AngeloGioacchino Del Regno, Jacky Huang,
Shan-Chun Hung, linux-kernel, linux-arm-kernel, linux-mediatek
Cc: George G. Davis, Mark A. Greer, Tianping.Fang, Adriana Stancu,
Alexander Bigga, Alexandre Belloni, Alexandre Torgue,
Andrew Jeffery, Andrew Morton, Avi Fishman, Benjamin Fair,
dmitry pervushin, Dmitry Rakhchev, Domen Puncer, Eddie Huang,
Enric Balletbo i Serra, Eric Liu, Gary Bisson, Hsin-Hsiung Wang,
Imre Kaloz, Johan Hovold, John Rigby, Joshua Kinard, linux-rtc,
linux-stm32, lm-sensors, Matthias Fuchs, Maxime Coquelin,
Medad CChien, Mia Lin, Ming-Jen Chen, Nancy Yuen, Nicolas Boichat,
Nishanth Menon, openbmc, Patrick Venture, Pavel Machek,
Peter Hartley, Piotr Ziecik, Ran Bi, Ryan Brue, Sean Wang,
Sergei Poselenov, source, Tali Perry, Tomer Maimon,
Wim Van Sebroeck, Wolfgang Grandegger, Wolfram Sang, Yingjoe Chen
These issues were reported by Sashiko.
None of these changes have been tested on physical hardware.
Cc: "George G. Davis" <gdavis@mvista.com>
Cc: "Mark A. Greer" <mgreer@mvista.com>
Cc: "Tianping.Fang" <tianping.fang@mediatek.com>
Cc: Adriana Stancu <adriana@arista.com>
Cc: Alexander Bigga <ab@mycable.de>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: Avi Fishman <avifishman70@gmail.com>
Cc: Benjamin Fair <benjaminfair@google.com>
Cc: dmitry pervushin <dpervushin@embeddedalley.com>
Cc: Dmitry Rakhchev <rda@emcraft.com>
Cc: Domen Puncer <domen.puncer@telargo.com>
Cc: Eddie Huang <eddie.huang@mediatek.com>
Cc: Enric Balletbo i Serra <eballetbo@kernel.org>
Cc: Eric Liu <liuer@nvidia.com>
Cc: Gary Bisson <gary.bisson@boundarydevices.com>
Cc: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>
Cc: Imre Kaloz <kaloz@kernel.org>
Cc: Jacky Huang <ychuang3@nuvoton.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: John Rigby <jcrigby@gmail.com>
Cc: Joshua Kinard <linux@kumba.dev>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-rtc@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: lm-sensors@lm-sensors.org
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Medad CChien <ctcchien@nuvoton.com>
Cc: Mia Lin <mimi05633@gmail.com>
Cc: Ming-Jen Chen <mjchen@nuvoton.com>
Cc: Nancy Yuen <yuenn@google.com>
Cc: Nicolas Boichat <drinkcat@chromium.org>
Cc: Nishanth Menon <nm@ti.com>
Cc: openbmc@lists.ozlabs.org
Cc: Patrick Venture <venture@google.com>
Cc: Pavel Machek <pavel@denx.de>
Cc: Peter Hartley <peter.hartley@sigmatel.com>
Cc: Piotr Ziecik <kosmo@semihalf.com>
Cc: Ran Bi <ran.bi@mediatek.com>
Cc: Ryan Brue <ryanbrue.dev@gmail.com>
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Sergei Poselenov <sposelenov@emcraft.com>
Cc: Shan-Chun Hung <schung@nuvoton.com>
Cc: source@mvista.com
Cc: Tali Perry <tali.perry1@gmail.com>
Cc: Tomer Maimon <tmaimon77@gmail.com>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Wolfram Sang <kernel@pengutronix.de>
Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
Lee Jones (10):
rtc: rx8025: pass parent I2C device in clock_adjust_ppb sysfs
callbacks
rtc: mt6397: handle non-DT platform device matching in probe
rtc: ma35d1: allocate RTC device before requesting interrupt
rtc: mpc5121: get interrupts via platform_get_irq()
rtc: m41t80: use devm helpers for square-wave clock registration
rtc: nct3018y: fix clock provider use-after-free and leak on unbind
rtc: stmp3xxx: unregister child watchdog platform device on unbind
rtc: ds1685: check driver data for NULL in ds1685_rtc_poweroff()
rtc: omap: prevent NULL and dangling pointer dereferences in power-off
path
rtc: bq32k: use u8 register buffer in trickle_charge_bypass sysfs
drivers/rtc/rtc-bq32k.c | 6 ++++--
drivers/rtc/rtc-ds1685.c | 6 ++----
drivers/rtc/rtc-m41t80.c | 5 +++--
drivers/rtc/rtc-ma35d1.c | 14 ++++++-------
drivers/rtc/rtc-mpc5121.c | 41 ++++++++++++++------------------------
drivers/rtc/rtc-mt6397.c | 19 ++++++++++++++++++
drivers/rtc/rtc-nct3018y.c | 3 ++-
drivers/rtc/rtc-omap.c | 21 +++++++++++--------
drivers/rtc/rtc-rx8025.c | 4 ++--
drivers/rtc/rtc-stmp3xxx.c | 29 ++++++++++++++++-----------
10 files changed, 84 insertions(+), 64 deletions(-)
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 02/10] rtc: mt6397: handle non-DT platform device matching in probe
2026-11-23 19:59 [PATCH 00/10] rtc: assorted bug fixes across RTC drivers Lee Jones
@ 2026-11-23 19:59 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2026-11-23 19:59 UTC (permalink / raw)
To: lee, Eddie Huang, Sean Wang, Alexandre Belloni, Matthias Brugger,
AngeloGioacchino Del Regno, Ryan Brue, Tianping.Fang,
Yingjoe Chen, Hsin-Hsiung Wang, Sebastian Reichel,
linux-arm-kernel, linux-mediatek, linux-rtc, linux-kernel
Cc: stable
The parent MediaTek PMIC MFD driver instantiates RTC platform
subdevices even when the optional RTC child Device Tree node is omitted,
and devices can also be bound via sysfs driver_override. In those
cases, of_device_get_match_data() returns NULL, yet mtk_rtc_probe()
succeeds with rtc->data left NULL and mtk_rtc_write_trigger()
subsequently crashes when dereferencing rtc->data->wrtgr.
Provide a platform_device_id table covering the MediaTek PMIC RTC cells
and fall back to platform_get_device_id() when no OF match data is
present, returning -ENODEV if neither match path provides driver data.
Fixes: 29ee40091e27 ("rtc: mt6397: Add support for the MediaTek MT6358 RTC")
Closes: https://sashiko.dev/#/bug/linux-35993d35-d776-4f86-9bd2-42c6ee078f88
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/rtc/rtc-mt6397.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index ab402f9f85c3..c40644ae509a 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -343,6 +343,14 @@ static int mtk_rtc_probe(struct platform_device *pdev)
rtc->addr_base = res->start;
rtc->data = of_device_get_match_data(&pdev->dev);
+ if (!rtc->data) {
+ const struct platform_device_id *id = platform_get_device_id(pdev);
+
+ if (!id)
+ return -ENODEV;
+
+ rtc->data = (const struct mtk_rtc_data *)id->driver_data;
+ }
rtc->irq = platform_get_irq(pdev, 0);
if (rtc->irq < 0)
@@ -427,6 +435,16 @@ static const struct of_device_id mt6397_rtc_of_match[] = {
};
MODULE_DEVICE_TABLE(of, mt6397_rtc_of_match);
+static const struct platform_device_id mt6397_rtc_id[] = {
+ { "mt6323-rtc", (kernel_ulong_t)&mt6397_rtc_data },
+ { "mt6357-rtc", (kernel_ulong_t)&mt6358_rtc_data },
+ { "mt6358-rtc", (kernel_ulong_t)&mt6358_rtc_data },
+ { "mt6359-rtc", (kernel_ulong_t)&mt6358_rtc_data },
+ { "mt6397-rtc", (kernel_ulong_t)&mt6397_rtc_data },
+ { }
+};
+MODULE_DEVICE_TABLE(platform, mt6397_rtc_id);
+
static struct platform_driver mtk_rtc_driver = {
.driver = {
.name = "mt6397-rtc",
@@ -434,6 +452,7 @@ static struct platform_driver mtk_rtc_driver = {
.pm = &mt6397_pm_ops,
},
.probe = mtk_rtc_probe,
+ .id_table = mt6397_rtc_id,
};
module_platform_driver(mtk_rtc_driver);
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 20:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 19:59 [PATCH 00/10] rtc: assorted bug fixes across RTC drivers Lee Jones
2026-11-23 19:59 ` [PATCH 02/10] rtc: mt6397: handle non-DT platform device matching in probe Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox