]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
soc: renesas: renesas-soc: Release 'chipid' from ioremap()
authorLi Yang <lidaxian@hust.edu.cn>
Fri, 31 Mar 2023 09:55:44 +0000 (17:55 +0800)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 4 Apr 2023 08:01:58 +0000 (10:01 +0200)
Smatch reports:

drivers/soc/renesas/renesas-soc.c:536 renesas_soc_init() warn:
'chipid' from ioremap() not released on lines: 475.

If soc_dev_atrr allocation is failed, function renesas_soc_init()
will return without releasing 'chipid' from ioremap().

Fix this by adding function iounmap().

Fixes: cb5508e47e60 ("soc: renesas: Add support for reading product revision for RZ/G2L family")
Signed-off-by: Li Yang <lidaxian@hust.edu.cn>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20230331095545.31823-1-lidaxian@hust.edu.cn
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
drivers/soc/renesas/renesas-soc.c

index 4ba893e45427608db9cb9b940dd16c07efad89a7..42af7c09f743340626fc43d7116f5ec890b00fb4 100644 (file)
@@ -469,8 +469,11 @@ static int __init renesas_soc_init(void)
        }
 
        soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
-       if (!soc_dev_attr)
+       if (!soc_dev_attr) {
+               if (chipid)
+                       iounmap(chipid);
                return -ENOMEM;
+       }
 
        np = of_find_node_by_path("/");
        of_property_read_string(np, "model", &soc_dev_attr->machine);