提交 fdbb9457 编写于 作者: M Markus Elfring 提交者: 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: NMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 a1bddf39
......@@ -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,7 +289,6 @@ 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) {
......@@ -308,8 +305,6 @@ static int axon_ram_probe(struct platform_device *device)
if (bank->io_addr != 0)
iounmap((void __iomem *) bank->io_addr);
kfree(bank);
}
return rc;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册