summaryrefslogtreecommitdiff
path: root/arch/mips
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 09:52:07 +0100
commit782f1f81e7a4bd76b9667a37dd56de148d693f49 (patch)
treed1aa684d77c89f0afe37fd8b458a9fb4fda7b5be /arch/mips
parent0468e351f01f04b36e654c31b846519f85fc9eb9 (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/mips')
-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 a1d98b5c8fd6..5c53b8aa43d2 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -959,12 +959,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;
}