Commit 6e6d847a authored by Jiasheng Jiang's avatar Jiasheng Jiang Committed by Arnd Bergmann

soc: aspeed: socinfo: Add kfree for kstrdup

Add kfree() in the later error handling in order to avoid memory leak.

Fixes: e0218dca ("soc: aspeed: Add soc info driver")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20230707021625.7727-1-jiasheng@iscas.ac.cnSigned-off-by: default avatarJoel Stanley <joel@jms.id.au>
Link: https://lore.kernel.org/r/20230810123104.231167-1-joel@jms.id.auSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent e4ad279a
...@@ -137,6 +137,7 @@ static int __init aspeed_socinfo_init(void) ...@@ -137,6 +137,7 @@ static int __init aspeed_socinfo_init(void)
soc_dev = soc_device_register(attrs); soc_dev = soc_device_register(attrs);
if (IS_ERR(soc_dev)) { if (IS_ERR(soc_dev)) {
kfree(attrs->machine);
kfree(attrs->soc_id); kfree(attrs->soc_id);
kfree(attrs->serial_number); kfree(attrs->serial_number);
kfree(attrs); kfree(attrs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment