fuse->base can not be unmapped if allocate lookups failed in
tegra_init_fuse(), because it is an early_initcall, the driver
will be loaded anyway and fuse->base will be accessed by other
functions later, so remove the return -ENOMEM after allocating
lookups failed to make less confusing.

Signed-off-by: Yang Yingliang <[email protected]>
---
 drivers/soc/tegra/fuse/fuse-tegra.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c 
b/drivers/soc/tegra/fuse/fuse-tegra.c
index 94b60a692b51..a0def1219501 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -490,9 +490,15 @@ static int __init tegra_init_fuse(void)
 
                fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL);
                if (!fuse->lookups)
-                       return -ENOMEM;
-
-               nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
+                       /*
+                        * fuse->base can not be unmapped if allocate lookups 
failed,
+                        * because it will be accessed by other functions later.
+                        * To make less confusing, remove the return -ENOMEM and
+                        * skip registering the nvmem cell lookups.
+                        */
+                       pr_err("failed to allocate lookups");
+               else
+                       nvmem_add_cell_lookups(fuse->lookups, 
fuse->soc->num_lookups);
        }
 
        return 0;
-- 
2.25.1

Reply via email to