]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
MIPS: DEC: Ensure RTC platform device deregistration upon failure
authorMaciej W. Rozycki <macro@orcam.me.uk>
Wed, 6 May 2026 22:43:00 +0000 (23:43 +0100)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Mon, 29 Jun 2026 09:27:15 +0000 (11:27 +0200)
Switch RTC platform device registration from platform_device_register()
to platform_add_devices() so as to make sure any failure will result in
automatic device unregistration.

Fixes: fae67ad43114 ("arch/mips/dec: switch DECstation systems to rtc-cmos")
Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/dec/platform.c

index 723ce16cbfc0ccaefa981c41d843a6494968b915..a005246a0ac5d27530f538c3272d2423adb31184 100644 (file)
@@ -38,6 +38,10 @@ static struct platform_device dec_rtc_device = {
        .num_resources = ARRAY_SIZE(dec_rtc_resources),
 };
 
+static struct platform_device *dec_rtc_devices[] __initdata = {
+       &dec_rtc_device,
+};
+
 static struct resource dec_dz_resources[] = {
        { .name = "dz", .flags = IORESOURCE_MEM, },
        { .name = "dz", .flags = IORESOURCE_IRQ, },
@@ -137,7 +141,7 @@ static int __init dec_add_devices(void)
        }
        num_zs = i;
 
-       ret1 = platform_device_register(&dec_rtc_device);
+       ret1 = platform_add_devices(dec_rtc_devices, 1);
        ret2 = IS_ENABLED(CONFIG_32BIT) ?
               platform_add_devices(dec_dz_devices, num_dz) : 0;
        ret3 = platform_add_devices(dec_zs_devices, num_zs);