summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorDing Xiang <dingxiang@cmss.chinamobile.com>2018-09-06 12:19:19 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-25 15:53:49 +0100
commit1f2952dd752e0918e0a85eef0eb4ec343d17fffb (patch)
treeccc145f2e7341fa804f78f17d20f93f238f67fc8 /arch
parent62396b1bfec4764245d99d13f21504bc6cc68fd9 (diff)
mips: txx9: fix iounmap related issue
[ Upstream commit c6e1241a82e6e74d1ae5cc34581dab2ffd6022d0 ] 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> Reviewed-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Paul Burton <paul.burton@mips.com> Patchwork: https://patchwork.linux-mips.org/patch/20476/ Cc: ralf@linux-mips.org Cc: jhogan@kernel.org Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/txx9/generic/setup.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 9d9962ab7d25..7dc97e944d5a 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -961,12 +961,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;
}