Skip to content

Commit

Permalink
soc: renesas: renesas-soc: Release 'chipid' from ioremap()
Browse files Browse the repository at this point in the history
[ Upstream commit fc187a4 ]

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: cb5508e ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
lidaxian121 authored and gregkh committed May 11, 2023
1 parent fd9d29d commit a5089a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/soc/renesas/renesas-soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,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);
Expand Down

0 comments on commit a5089a3

Please sign in to comment.