soc/tegra: fuse: Unmap registers once they are not needed anymore
authorDmitry Osipenko <digetx@gmail.com>
Wed, 18 Dec 2019 18:23:04 +0000 (21:23 +0300)
committerThierry Reding <treding@nvidia.com>
Fri, 10 Jan 2020 14:59:43 +0000 (15:59 +0100)
Both Chip ID and strapping registers are now read out during of APB MISC
initialization, the registers' mapping isn't needed anymore once registers
are read. Hence let's unmap registers once they are not needed anymore,
for consistency.

Suggested-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/soc/tegra/fuse/tegra-apbmisc.c

index 6259390..4a737f1 100644 (file)
@@ -158,16 +158,20 @@ void __init tegra_init_apbmisc(void)
        }
 
        apbmisc_base = ioremap_nocache(apbmisc.start, resource_size(&apbmisc));
-       if (!apbmisc_base)
+       if (!apbmisc_base) {
                pr_err("failed to map APBMISC registers\n");
-       else
+       } else {
                chipid = readl_relaxed(apbmisc_base + 4);
+               iounmap(apbmisc_base);
+       }
 
        strapping_base = ioremap_nocache(straps.start, resource_size(&straps));
-       if (!strapping_base)
+       if (!strapping_base) {
                pr_err("failed to map strapping options registers\n");
-       else
+       } else {
                strapping = readl_relaxed(strapping_base);
+               iounmap(strapping_base);
+       }
 
        long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code");
 }