diff mbox series

soc: aspeed: socinfo: Add kfree for kstrdup

Message ID 20230810123104.231167-1-joel@jms.id.au (mailing list archive)
State Accepted
Commit 6e6d847a8ce18ab2fbec4f579f682486a82d2c6b
Headers show
Series soc: aspeed: socinfo: Add kfree for kstrdup | expand

Commit Message

Joel Stanley Aug. 10, 2023, 12:31 p.m. UTC
From: Jiasheng Jiang <jiasheng@iscas.ac.cn>

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 <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20230707021625.7727-1-jiasheng@iscas.ac.cn
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
Hi soc maintainers, this is a low priority fix to be merged when appropriate.

 drivers/soc/aspeed/aspeed-socinfo.c | 1 +
 1 file changed, 1 insertion(+)

Comments

patchwork-bot+linux-soc@kernel.org Aug. 12, 2023, 10:20 a.m. UTC | #1
Hello:

This patch was applied to soc/soc.git (arm/fixes)
by Arnd Bergmann <arnd@arndb.de>:

On Thu, 10 Aug 2023 22:01:04 +0930 you wrote:
> From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> 
> 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 <jiasheng@iscas.ac.cn>
> Link: https://lore.kernel.org/r/20230707021625.7727-1-jiasheng@iscas.ac.cn
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> 
> [...]

Here is the summary with links:
  - soc: aspeed: socinfo: Add kfree for kstrdup
    https://git.kernel.org/soc/soc/c/6e6d847a8ce1

You are awesome, thank you!
diff mbox series

Patch

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);