aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiasheng Jiang <[email protected]>2023-08-10 22:01:04 +0930
committerArnd Bergmann <[email protected]>2023-08-12 12:12:58 +0200
commit6e6d847a8ce18ab2fbec4f579f682486a82d2c6b (patch)
treeeb551142bdb4ba60e22a8d90068683d10599cc97
parente4ad279ae345413d900d791f2f618d0a1cd0d791 (diff)
soc: aspeed: socinfo: Add kfree for kstrdup
Add kfree() in the later error handling in order to avoid memory leak. Fixes: e0218dca5787 ("soc: aspeed: Add soc info driver") Signed-off-by: Jiasheng Jiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
-rw-r--r--drivers/soc/aspeed/aspeed-socinfo.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/soc/aspeed/aspeed-socinfo.c b/drivers/soc/aspeed/aspeed-socinfo.c
index 1ca140356a08..3f759121dc00 100644
--- a/drivers/soc/aspeed/aspeed-socinfo.c
+++ b/drivers/soc/aspeed/aspeed-socinfo.c
@@ -137,6 +137,7 @@ static int __init aspeed_socinfo_init(void)
soc_dev = soc_device_register(attrs);
if (IS_ERR(soc_dev)) {
+ kfree(attrs->machine);
kfree(attrs->soc_id);
kfree(attrs->serial_number);
kfree(attrs);