All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ding Xiang <dingxiang@cmss.chinamobile.com>
To: ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Cc: dingxiang@cmss.chinamobile.com
Subject: [PATCH] mips: txx9: fix iounmap related issue
Date: Thu,  6 Sep 2018 12:19:19 +0800	[thread overview]
Message-ID: <1536207559-31543-1-git-send-email-dingxiang@cmss.chinamobile.com> (raw)

if device_register return error, iounmap should be called, also iounmap
need to call before put_device.

Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
---
 arch/mips/txx9/generic/setup.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index f6d9182..70a1ab6 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -960,12 +960,11 @@ void __init txx9_sramc_init(struct resource *r)
 		goto exit_put;
 	err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr);
 	if (err) {
-		device_unregister(&dev->dev);
 		iounmap(dev->base);
-		kfree(dev);
+		device_unregister(&dev->dev);
 	}
 	return;
 exit_put:
+	iounmap(dev->base);
 	put_device(&dev->dev);
-	return;
 }
-- 
1.9.1




             reply	other threads:[~2018-09-06  4:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06  4:19 Ding Xiang [this message]
2018-09-06 15:04 ` [PATCH] mips: txx9: fix iounmap related issue Atsushi Nemoto
2018-09-06 21:16 ` Paul Burton

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=1536207559-31543-1-git-send-email-dingxiang@cmss.chinamobile.com \
    --to=dingxiang@cmss.chinamobile.com \
    --cc=jhogan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=paul.burton@mips.com \
    --cc=ralf@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.