Commit fdbb9457 authored by Markus Elfring's avatar Markus Elfring Committed by Michael Ellerman

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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent a1bddf39
...@@ -192,10 +192,8 @@ static int axon_ram_probe(struct platform_device *device) ...@@ -192,10 +192,8 @@ static int axon_ram_probe(struct platform_device *device)
device->dev.of_node); device->dev.of_node);
bank = kzalloc(sizeof(*bank), GFP_KERNEL); bank = kzalloc(sizeof(*bank), GFP_KERNEL);
if (bank == NULL) { if (!bank)
rc = -ENOMEM; return -ENOMEM;
goto failed;
}
device->dev.platform_data = bank; device->dev.platform_data = bank;
...@@ -291,7 +289,6 @@ static int axon_ram_probe(struct platform_device *device) ...@@ -291,7 +289,6 @@ static int axon_ram_probe(struct platform_device *device)
return 0; return 0;
failed: failed:
if (bank != NULL) {
if (bank->irq_id) if (bank->irq_id)
free_irq(bank->irq_id, device); free_irq(bank->irq_id, device);
if (bank->disk != NULL) { if (bank->disk != NULL) {
...@@ -308,8 +305,6 @@ static int axon_ram_probe(struct platform_device *device) ...@@ -308,8 +305,6 @@ static int axon_ram_probe(struct platform_device *device)
if (bank->io_addr != 0) if (bank->io_addr != 0)
iounmap((void __iomem *) bank->io_addr); iounmap((void __iomem *) bank->io_addr);
kfree(bank); kfree(bank);
}
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment