]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
rtc: goldfish: Return error when device address is invalid
authorKuan-Wei Chiu <visitorckw@gmail.com>
Mon, 8 Jun 2026 15:47:49 +0000 (15:47 +0000)
committerTom Rini <trini@konsulko.com>
Tue, 23 Jun 2026 18:38:01 +0000 (12:38 -0600)
goldfish_rtc_of_to_plat() currently returns success even when
dev_read_addr() fails to find a valid address. This leaves plat->reg
unset (or 0) and defers the failure to probe().

Return -EINVAL immediately when the address is FDT_ADDR_T_NONE so the
failure is reported at the of_to_plat stage where it belongs. This
aligns the driver with the recent fix introduced in the goldfish
serial driver by Naveen Kumar Chaudhary. [1]

Link: https://lore.kernel.org/u-boot/vgwnt6mnls3lf3zdm6mz5siztzkvppte4ykszbvifjzukvmksf@maaxe5agqpim/
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
drivers/rtc/goldfish_rtc.c

index 4892a63f8d80d05e41ec9c34a6307a749c05102e..652eec7dd0c99287c33142eb2c2a7ee94bd75473 100644 (file)
@@ -80,9 +80,13 @@ static int goldfish_rtc_of_to_plat(struct udevice *dev)
        struct goldfish_rtc_plat *plat = dev_get_plat(dev);
        fdt_addr_t addr;
 
+       plat->reg = 0;
+
        addr = dev_read_addr(dev);
-       if (addr != FDT_ADDR_T_NONE)
-               plat->reg = addr;
+       if (addr == FDT_ADDR_T_NONE)
+               return -EINVAL;
+
+       plat->reg = addr;
 
        return 0;
 }