* [PATCH] ARM: locomo: fix free dev incorrectly
@ 2018-01-09 14:37 Xiongwei Song
2018-01-09 14:47 ` Russell King - ARM Linux
0 siblings, 1 reply; 2+ messages in thread
From: Xiongwei Song @ 2018-01-09 14:37 UTC (permalink / raw)
To: linux, rafael.j.wysocki, ulf.hansson
Cc: linux-arm-kernel, linux-kernel, sxwjean
In function locomo_init_one_child, If kzalloc call is failed for dev we
would goto out label, then call kfree for dev, however, dev is NULL, we
shouldn't do this.
Signed-off-by: Xiongwei Song <sxwjean@me.com>
---
arch/arm/common/locomo.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 51936bde1eb2..fb21b5ade391 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -256,10 +256,9 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
NO_IRQ : lchip->irq_base + info->irq[0];
ret = device_register(&dev->dev);
- if (ret) {
- out:
+ if (ret)
kfree(dev);
- }
+ out:
return ret;
}
--
2.15.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: locomo: fix free dev incorrectly
2018-01-09 14:37 [PATCH] ARM: locomo: fix free dev incorrectly Xiongwei Song
@ 2018-01-09 14:47 ` Russell King - ARM Linux
0 siblings, 0 replies; 2+ messages in thread
From: Russell King - ARM Linux @ 2018-01-09 14:47 UTC (permalink / raw)
To: Xiongwei Song
Cc: rafael.j.wysocki, ulf.hansson, linux-arm-kernel, linux-kernel, sxwjean
On Tue, Jan 09, 2018 at 10:37:55PM +0800, Xiongwei Song wrote:
> In function locomo_init_one_child, If kzalloc call is failed for dev we
> would goto out label, then call kfree for dev, however, dev is NULL, we
> shouldn't do this.
kfree() internally checks for NULL pointers so callers don't have to.
Your patch is not necessary.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-09 15:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-09 14:37 [PATCH] ARM: locomo: fix free dev incorrectly Xiongwei Song
2018-01-09 14:47 ` Russell King - ARM Linux
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®