[PATCH] bestcomm: no need to free when kzalloc fail

From: chenlibo . 3
Date: Sun May 05 2013 - 04:38:31 EST


From: Libo Chen <libo.chen@xxxxxxxxxx>

There is no need to free bcom_eng if kzalloc fail

Signed-off-by: Libo Chen <libo.chen@xxxxxxxxxx>
---
drivers/dma/bestcomm/bestcomm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/bestcomm/bestcomm.c b/drivers/dma/bestcomm/bestcomm.c
index a8c2e29..300ee2d 100644
--- a/drivers/dma/bestcomm/bestcomm.c
+++ b/drivers/dma/bestcomm/bestcomm.c
@@ -400,7 +400,7 @@ static int mpc52xx_bcom_probe(struct platform_device *op)
printk(KERN_ERR DRIVER_NAME ": "
"Can't allocate state structure\n");
rv = -ENOMEM;
- goto error_sramclean;
+ goto error_kzalloc;
}

/* Save the node */
@@ -449,6 +449,7 @@ error_release:
release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
error_sramclean:
kfree(bcom_eng);
+error_kzalloc:
bcom_sram_cleanup();
error_ofput:
of_node_put(op->dev.of_node);
--
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/