Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [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-arm-kernel

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 related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-09 14:47 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