[PATCH -next 1/3] platform/loongarch: laptop: add missing platform_driver_unregister() in generic_subdriver_exit()

From: Yang Yingliang
Date: Sat Oct 08 2022 - 23:41:02 EST


If setup_acpi_notify() fails in generic_subdriver_init(),
platform_driver_unregister() need be called. Call it in
generic_subdriver_exit().

Fixes: ee7fa5029de8 ("LoongArch: Add ACPI-based generic laptop driver")
Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
---
drivers/platform/loongarch/loongson-laptop.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/platform/loongarch/loongson-laptop.c b/drivers/platform/loongarch/loongson-laptop.c
index e61fe7c305e0..d9f82c3991c0 100644
--- a/drivers/platform/loongarch/loongson-laptop.c
+++ b/drivers/platform/loongarch/loongson-laptop.c
@@ -535,6 +535,7 @@ static void generic_subdriver_exit(struct generic_sub_driver *sub_driver)
sub_driver->type, dispatch_acpi_notify);
sub_driver->acpi_notify_installed = 0;
}
+ platform_driver_unregister(sub_driver->driver);
}

static struct generic_sub_driver generic_sub_drivers[] __refdata = {
--
2.25.1