Skip to content

Commit eacaf5a

Browse files
maciej-w-rozyckitsbogend
authored andcommitted
MIPS: DEC: Ensure RTC platform device deregistration upon failure
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: fae67ad ("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>
1 parent dc59e4f commit eacaf5a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

arch/mips/dec/platform.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ static struct platform_device dec_rtc_device = {
3838
.num_resources = ARRAY_SIZE(dec_rtc_resources),
3939
};
4040

41+
static struct platform_device *dec_rtc_devices[] __initdata = {
42+
&dec_rtc_device,
43+
};
44+
4145
static struct resource dec_dz_resources[] = {
4246
{ .name = "dz", .flags = IORESOURCE_MEM, },
4347
{ .name = "dz", .flags = IORESOURCE_IRQ, },
@@ -137,7 +141,7 @@ static int __init dec_add_devices(void)
137141
}
138142
num_zs = i;
139143

140-
ret1 = platform_device_register(&dec_rtc_device);
144+
ret1 = platform_add_devices(dec_rtc_devices, 1);
141145
ret2 = IS_ENABLED(CONFIG_32BIT) ?
142146
platform_add_devices(dec_dz_devices, num_dz) : 0;
143147
ret3 = platform_add_devices(dec_zs_devices, num_zs);

0 commit comments

Comments
 (0)