[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ac2613a8-af99-0a87-c80f-f5e7af934198@huawei.com>
Date: Mon, 26 Sep 2022 17:14:51 +0800
From: "linyujun (C)" <linyujun809@...wei.com>
To: <daniel@...que.org>, <haojian.zhuang@...il.com>,
<robert.jarzmik@...e.fr>, <linux@...linux.org.uk>,
<marc.zyngier@...ran.com>
CC: <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] viper_tpm_init(): fix memleak on registration
failure
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@...wei.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);
> }
Powered by blists - more mailing lists