From: Russell King Date: Tue, 6 Sep 2016 14:29:26 +0000 (+0100) Subject: ARM: sa1111: use devm_kzalloc() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7d53c1f01210aa79838f1fe34b2a89f8e900d720;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ARM: sa1111: use devm_kzalloc() Use devm_kzalloc() to allocate our driver data, so we can eliminate its kfree() from the device removal and error cleanup paths. Signed-off-by: Russell King --- diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index 303c62861d84..f2ce21c03646 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c @@ -696,7 +696,7 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq) if (!pd) return -EINVAL; - sachip = kzalloc(sizeof(struct sa1111), GFP_KERNEL); + sachip = devm_kzalloc(me, sizeof(struct sa1111), GFP_KERNEL); if (!sachip) return -ENOMEM; @@ -808,7 +808,6 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq) err_clkput: clk_put(sachip->clk); err_free: - kfree(sachip); return ret; } @@ -847,7 +846,6 @@ static void __sa1111_remove(struct sa1111 *sachip) iounmap(sachip->base); clk_put(sachip->clk); - kfree(sachip); } struct sa1111_save_data {