[PATCH 4.4 029/159] mips: txx9: fix iounmap related issue
Greg Kroah-Hartman <[email protected]> Fri, 22 Nov 2019 11:27:00 +0100
| Newsgroups | gmane.linux.kernel.stable,gmane.linux.kernel,gmane.linux.ports.mips.general |
|---|---|
| Message-ID | <[email protected]> |
From: Ding Xiang <[email protected]> [ 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 <[email protected]> Reviewed-by: Atsushi Nemoto <[email protected]> Signed-off-by: Paul Burton <[email protected]> Patchwork: https://patchwork.linux-mips.org/patch/20476/ Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Sasha Levin <[email protected]> --- 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 9d9962ab7d25c..7dc97e944d5aa 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; } -- 2.20.1