[PATCH] rtc: ftrtc010: use devm_platform_ioremap_resource()
From: Rosen Penev
Date: Sun Oct 04 2026 - 18:03:09 EST
Replace the open-coded platform_get_resource() plus devm_ioremap()
sequence with devm_platform_ioremap_resource(), and propagate its
ERR_PTR() directly.
This also reserves the MMIO region. The only user, gemini.dtsi,
describes a single 0x100 window at 0x45000000 that no other node
overlaps, so this introduces no conflict.
Assisted-by: LLM
Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
drivers/rtc/rtc-ftrtc010.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/rtc/rtc-ftrtc010.c b/drivers/rtc/rtc-ftrtc010.c
index b29c96be40f4..3e88cb224f67 100644
--- a/drivers/rtc/rtc-ftrtc010.c
+++ b/drivers/rtc/rtc-ftrtc010.c
@@ -111,7 +111,6 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev)
u32 days, hour, min, sec;
struct ftrtc010_rtc *rtc;
struct device *dev = &pdev->dev;
- struct resource *res;
struct rtc_device *rtc_dev;
int ret;
@@ -135,14 +134,9 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev)
if (rtc->rtc_irq < 0)
return rtc->rtc_irq;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
-
- rtc->rtc_base = devm_ioremap(dev, res->start,
- resource_size(res));
- if (!rtc->rtc_base)
- return -ENOMEM;
+ rtc->rtc_base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(rtc->rtc_base))
+ return PTR_ERR(rtc->rtc_base);
rtc_dev = devm_rtc_allocate_device(dev);
if (IS_ERR(rtc_dev))
--
2.56.0