summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin Shan <gshan@redhat.com>2020-09-22 16:04:15 +0300
committerWill Deacon <will@kernel.org>2020-09-28 23:52:22 +0300
commit63627cae41e33763ca967bd2bb8cfe5d281bfe64 (patch)
treee2786042052a83057368dd1b892731471185bf3e
parent10fd7c42b7953b3316806388493bff22abd3f78c (diff)
downloadlinux-63627cae41e33763ca967bd2bb8cfe5d281bfe64.tar.xz
firmware: arm_sdei: Unregister driver on error in sdei_init()
The SDEI platform device is created from device-tree node or ACPI (SDEI) table. For the later case, the platform device is created explicitly by this module. It'd better to unregister the driver on failure to create the device to keep the symmetry. The driver, owned by this module, isn't needed if the device isn't existing. Besides, the errno (@ret) should be updated accordingly in this case. Signed-off-by: Gavin Shan <gshan@redhat.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: James Morse <james.morse@arm.com> Link: https://lore.kernel.org/r/20200922130423.10173-6-gshan@redhat.com Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r--drivers/firmware/arm_sdei.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
index 1fa4e577b78e..e7e9059c395b 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;
}