diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-08-03 21:23:57 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-09-01 09:42:56 +0300 |
commit | fdbb9457b4e1d3a6deb3325bba7616334f371be7 (patch) | |
tree | d795e257a7a540c828e4b3827d8b3b1af2b30637 /arch/powerpc | |
parent | a1bddf3991573f3dff2762bfca5e113f19889d5a (diff) | |
download | linux-fdbb9457b4e1d3a6deb3325bba7616334f371be7.tar.xz |
axonram: Return directly after a failed kzalloc() in axon_ram_probe()
* Return directly after a call of the function "kzalloc" failed
at the beginning.
* Delete a repeated check for the local variable "bank"
which became unnecessary with this refactoring.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/sysdev/axonram.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c index ae359d78b7db..58507c3fbcd0 100644 --- a/arch/powerpc/sysdev/axonram.c +++ b/arch/powerpc/sysdev/axonram.c @@ -192,10 +192,8 @@ static int axon_ram_probe(struct platform_device *device) device->dev.of_node); bank = kzalloc(sizeof(*bank), GFP_KERNEL); - if (bank == NULL) { - rc = -ENOMEM; - goto failed; - } + if (!bank) + return -ENOMEM; device->dev.platform_data = bank; @@ -291,25 +289,22 @@ static int axon_ram_probe(struct platform_device *device) return 0; failed: - if (bank != NULL) { - if (bank->irq_id) - free_irq(bank->irq_id, device); - if (bank->disk != NULL) { - if (bank->disk->major > 0) - unregister_blkdev(bank->disk->major, - bank->disk->disk_name); - if (bank->disk->flags & GENHD_FL_UP) - del_gendisk(bank->disk); - put_disk(bank->disk); - } - kill_dax(bank->dax_dev); - put_dax(bank->dax_dev); - device->dev.platform_data = NULL; - if (bank->io_addr != 0) - iounmap((void __iomem *) bank->io_addr); - kfree(bank); + if (bank->irq_id) + free_irq(bank->irq_id, device); + if (bank->disk != NULL) { + if (bank->disk->major > 0) + unregister_blkdev(bank->disk->major, + bank->disk->disk_name); + if (bank->disk->flags & GENHD_FL_UP) + del_gendisk(bank->disk); + put_disk(bank->disk); } - + kill_dax(bank->dax_dev); + put_dax(bank->dax_dev); + device->dev.platform_data = NULL; + if (bank->io_addr != 0) + iounmap((void __iomem *) bank->io_addr); + kfree(bank); return rc; } |