Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sxwjean@me.com (Xiongwei Song)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: locomo: fix free dev incorrectly
Date: Tue, 09 Jan 2018 22:37:55 +0800	[thread overview]
Message-ID: <20180109143755.16931-1-sxwjean@me.com> (raw)

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

             reply	other threads:[~2018-01-09 14:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09 14:37 Xiongwei Song [this message]
2018-01-09 14:47 ` [PATCH] ARM: locomo: fix free dev incorrectly Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180109143755.16931-1-sxwjean@me.com \
    --to=sxwjean@me.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox