diff options
author | Gavin Shan <gshan@redhat.com> | 2020-09-22 15:04:14 +0200 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2020-09-28 22:52:22 +0200 |
commit | 10fd7c42b7953b3316806388493bff22abd3f78c (patch) | |
tree | c9a73a075deb4bc8fa559e373cb1ecccde086c81 /drivers/firmware/arm_sdei.c | |
parent | firmware: arm_sdei: Retrieve event number from event instance (diff) | |
download | linux-10fd7c42b7953b3316806388493bff22abd3f78c.tar.xz linux-10fd7c42b7953b3316806388493bff22abd3f78c.zip |
firmware: arm_sdei: Avoid nested statements in sdei_init()
In sdei_init(), the nested statements can be avoided by bailing
on error from platform_driver_register() or absent ACPI SDEI table.
With it, the code looks a bit more readable.
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-5-gshan@redhat.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'drivers/firmware/arm_sdei.c')
-rw-r--r-- | drivers/firmware/arm_sdei.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c index 0f49fff20cc7..1fa4e577b78e 100644 --- a/drivers/firmware/arm_sdei.c +++ b/drivers/firmware/arm_sdei.c @@ -1081,17 +1081,18 @@ static bool __init sdei_present_acpi(void) static int __init sdei_init(void) { - int ret = platform_driver_register(&sdei_driver); - - if (!ret && sdei_present_acpi()) { - struct platform_device *pdev; - - 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)); - } + struct platform_device *pdev; + int ret; + + ret = platform_driver_register(&sdei_driver); + if (ret || !sdei_present_acpi()) + return ret; + + 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)); return ret; } |