linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform: arm64: huawei-gaokun-ec: fix OF node leak
@ 2025-07-08  8:53 Johan Hovold
  2025-07-10 12:11 ` Pengyu Luo
  2025-07-11 16:26 ` Ilpo Järvinen
  0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2025-07-08  8:53 UTC (permalink / raw)
  To: Pengyu Luo, Hans de Goede, Ilpo Järvinen
  Cc: Bryan ODonoghue, platform-driver-x86, linux-kernel, Johan Hovold

Make sure to drop the OF node reference taken when creating the Gaokun
auxiliary devices when the devices are later released.

Fixes: 7636f090d02e ("platform: arm64: add Huawei Matebook E Go EC driver")
Cc: Pengyu Luo <mitltlatltl@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/platform/arm64/huawei-gaokun-ec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/platform/arm64/huawei-gaokun-ec.c b/drivers/platform/arm64/huawei-gaokun-ec.c
index 7e5aa7ca2403..7170f8eb76f7 100644
--- a/drivers/platform/arm64/huawei-gaokun-ec.c
+++ b/drivers/platform/arm64/huawei-gaokun-ec.c
@@ -662,6 +662,7 @@ static void gaokun_aux_release(struct device *dev)
 {
 	struct auxiliary_device *adev = to_auxiliary_dev(dev);
 
+	of_node_put(dev->of_node);
 	kfree(adev);
 }
 
@@ -693,6 +694,7 @@ static int gaokun_aux_init(struct device *parent, const char *name,
 
 	ret = auxiliary_device_init(adev);
 	if (ret) {
+		of_node_put(adev->dev.of_node);
 		kfree(adev);
 		return ret;
 	}
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform: arm64: huawei-gaokun-ec: fix OF node leak
  2025-07-08  8:53 [PATCH] platform: arm64: huawei-gaokun-ec: fix OF node leak Johan Hovold
@ 2025-07-10 12:11 ` Pengyu Luo
  2025-07-11 16:26 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Pengyu Luo @ 2025-07-10 12:11 UTC (permalink / raw)
  To: johan
  Cc: bryan.odonoghue, hansg, ilpo.jarvinen, linux-kernel, mitltlatltl,
	platform-driver-x86

On Tue, Jul 8, 2025 at 4:54 PM Johan Hovold <johan@kernel.org> wrote:
> Make sure to drop the OF node reference taken when creating the Gaokun
> auxiliary devices when the devices are later released.
>
> Fixes: 7636f090d02e ("platform: arm64: add Huawei Matebook E Go EC driver")
> Cc: Pengyu Luo <mitltlatltl@gmail.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/platform/arm64/huawei-gaokun-ec.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/platform/arm64/huawei-gaokun-ec.c b/drivers/platform/arm64/huawei-gaokun-ec.c
> index 7e5aa7ca2403..7170f8eb76f7 100644
> --- a/drivers/platform/arm64/huawei-gaokun-ec.c
> +++ b/drivers/platform/arm64/huawei-gaokun-ec.c
> @@ -662,6 +662,7 @@ static void gaokun_aux_release(struct device *dev)
>  {
>         struct auxiliary_device *adev = to_auxiliary_dev(dev);
>
> +       of_node_put(dev->of_node);
>         kfree(adev);
>  }
>
> @@ -693,6 +694,7 @@ static int gaokun_aux_init(struct device *parent, const char *name,
>
>         ret = auxiliary_device_init(adev);
>         if (ret) {
> +               of_node_put(adev->dev.of_node);
>                 kfree(adev);
>                 return ret;
>         }
> --
> 2.49.0
>

Oh, I should have checked `device_set_of_node_from_dev`, but I forgot,
thanks for fixing this.

Reviewed-by: Pengyu Luo <mitltlatltl@gmail.com>

Best wishes,
Pengyu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform: arm64: huawei-gaokun-ec: fix OF node leak
  2025-07-08  8:53 [PATCH] platform: arm64: huawei-gaokun-ec: fix OF node leak Johan Hovold
  2025-07-10 12:11 ` Pengyu Luo
@ 2025-07-11 16:26 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2025-07-11 16:26 UTC (permalink / raw)
  To: Pengyu Luo, Hans de Goede, Johan Hovold
  Cc: Bryan ODonoghue, platform-driver-x86, linux-kernel

On Tue, 08 Jul 2025 10:53:58 +0200, Johan Hovold wrote:

> Make sure to drop the OF node reference taken when creating the Gaokun
> auxiliary devices when the devices are later released.
> 
> 


Thank you for your contribution, it has been applied to my local
review-ilpo-fixes branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform: arm64: huawei-gaokun-ec: fix OF node leak
      commit: bc48d79a1829ac5a79cc3d1eb8bf30c0ae9b3bcd

--
 i.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-11 16:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-08  8:53 [PATCH] platform: arm64: huawei-gaokun-ec: fix OF node leak Johan Hovold
2025-07-10 12:11 ` Pengyu Luo
2025-07-11 16:26 ` Ilpo Järvinen

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