[PATCH v2 05/17] drivers/firmware/sdei: Unregister driver on error in sdei_init()
Gavin Shan
gshan at redhat.com
Wed Jul 22 05:57:28 EDT 2020
The platform driver needs to be unregistered on error to create the
platform device, so that the state is restored to original one.
Besides, the errno (@ret) should be updated acccording in that case.
Signed-off-by: Gavin Shan <gshan at redhat.com>
---
v2: Derived from "drivers/firmware/sdei: Rework sdei_init()"
Unregister platform driver instead of platform device
Remove duplicate ACPI enablement checker
Update errno (@ret) accordingly
---
drivers/firmware/arm_sdei.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
index c9f2bedfb6b5..909f27abf8a7 100644
--- a/drivers/firmware/arm_sdei.c
+++ b/drivers/firmware/arm_sdei.c
@@ -1090,9 +1090,12 @@ static int __init sdei_init(void)
pdev = platform_device_register_simple(sdei_driver.driver.name,
0, NULL, 0);
- if (IS_ERR(pdev))
- pr_info("Failed to register ACPI:SDEI platform device %ld\n",
- PTR_ERR(pdev));
+ if (IS_ERR(pdev)) {
+ ret = PTR_ERR(pdev);
+ platform_driver_unregister(&sdei_driver);
+ pr_info("Failed to register ACPI:SDEI platform device %d\n",
+ ret);
+ }
return ret;
}
--
2.23.0
More information about the linux-arm-kernel
mailing list