* [PATCH -next] viper_tpm_init(): fix memleak on registration failure
@ 2022-09-14 3:16 Lin Yujun
2022-09-26 9:14 ` linyujun (C)
0 siblings, 1 reply; 2+ messages in thread
From: Lin Yujun @ 2022-09-14 3:16 UTC (permalink / raw)
To: daniel, haojian.zhuang, robert.jarzmik, linux, marc.zyngier
Cc: linux-arm-kernel, linux-kernel
In case device registration fails, the platform device
structure needs to be free. Use platform_device_put()
to free all resources instead of using kfree to release
the platform device.
Fixes: 352699a3d7cc ("Basic support for the Arcom/Eurotech Viper SBC.")
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
---
arch/arm/mach-pxa/viper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index 5b43351ee840..44b2c54fb2c7 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -829,7 +829,7 @@ static void __init viper_tpm_init(void)
return;
error_free_tpm:
- kfree(tpm_device);
+ platform_device_put(tpm_device);
error_tpm:
pr_err("viper: Couldn't %s, giving up\n", errstr);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] viper_tpm_init(): fix memleak on registration failure
2022-09-14 3:16 [PATCH -next] viper_tpm_init(): fix memleak on registration failure Lin Yujun
@ 2022-09-26 9:14 ` linyujun (C)
0 siblings, 0 replies; 2+ messages in thread
From: linyujun (C) @ 2022-09-26 9:14 UTC (permalink / raw)
To: daniel, haojian.zhuang, robert.jarzmik, linux, marc.zyngier
Cc: linux-arm-kernel, linux-kernel
kindly ping
在 2022/9/14 11:16, Lin Yujun 写道:
> In case device registration fails, the platform device
> structure needs to be free. Use platform_device_put()
> to free all resources instead of using kfree to release
> the platform device.
>
> Fixes: 352699a3d7cc ("Basic support for the Arcom/Eurotech Viper SBC.")
> Signed-off-by: Lin Yujun <linyujun809@huawei.com>
> ---
> arch/arm/mach-pxa/viper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
> index 5b43351ee840..44b2c54fb2c7 100644
> --- a/arch/arm/mach-pxa/viper.c
> +++ b/arch/arm/mach-pxa/viper.c
> @@ -829,7 +829,7 @@ static void __init viper_tpm_init(void)
> return;
>
> error_free_tpm:
> - kfree(tpm_device);
> + platform_device_put(tpm_device);
> error_tpm:
> pr_err("viper: Couldn't %s, giving up\n", errstr);
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-26 9:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14 3:16 [PATCH -next] viper_tpm_init(): fix memleak on registration failure Lin Yujun
2022-09-26 9:14 ` linyujun (C)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).