mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Ronald Claveau <linux-kernel-dev@aliel.fr>
To: sashiko-reviews@lists.linux.dev
Cc: linux-amlogic@lists.infradead.org, conor+dt@kernel.org,
	robh@kernel.org, lee@kernel.org, mfd@lists.linux.dev,
	devicetree@vger.kernel.org, neil.armstrong@linaro.org
Subject: Re: [PATCH v12 4/6] thermal: khadas-mcu-fan: Add fan config from platform data Add regulator support
Date: Fri, 18 Sep 2026 10:54:24 +0200	[thread overview]
Message-ID: <1a28af11-54b9-48c3-a31c-85d9edb74af6@aliel.fr> (raw)
In-Reply-To: <20260917081309.8FBD21F000FF@smtp.kernel.org>

On 9/17/26 10:13 AM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] thermal: khadas-mcu-fan: OF node reference leak in probe
> --
> 
> commit c3a0644be46518f47124644a90235d26979c4299
> Author: Ronald Claveau <linux-kernel-dev@aliel.fr>
> 
> thermal: khadas-mcu-fan: Add fan config from platform data Add regulator support
> 
> This commit introduces variant-specific platform data including control
> registers and duty-cycle levels, while also bumping the maximum level.
> It optionally acquires and enables a fan regulator supply at probe time
> to handle boards that gate fan power.
> 
>> diff --git a/drivers/thermal/khadas_mcu_fan.c b/drivers/thermal/khadas_mcu_fan.c
>> index 21b3d0a71bd0d..1da639d054971 100644
>> --- a/drivers/thermal/khadas_mcu_fan.c
>> +++ b/drivers/thermal/khadas_mcu_fan.c
> [ ... ]
>> @@ -76,22 +82,71 @@ static const struct thermal_cooling_device_ops khadas_mcu_fan_cooling_ops = {
>>  static int khadas_mcu_fan_probe(struct platform_device *pdev)
>>  {
>> +	const struct platform_device_id *id = platform_get_device_id(pdev);
>>  	struct khadas_mcu *mcu = dev_get_drvdata(pdev->dev.parent);
>>  	struct thermal_cooling_device *cdev;
>>  	struct device *dev = &pdev->dev;
>>  	struct khadas_mcu_fan_ctx *ctx;
>>  	int ret;
>>  
>> +
>> +	if (!dev->of_node)
>> +		dev->of_node = of_node_get(dev->parent->of_node);
> 
> [Severity: Medium]
> Does this leak the OF node reference? The probe function explicitly
> acquires the node with of_node_get() and assigns it to dev->of_node,
> but there is no corresponding cleanup mechanism.
> 
> Since there is no .remove callback or devm action registered to call
> of_node_put(), and the driver core does not automatically drop
> references assigned directly to dev->of_node in this manner, the
> reference count appears to leak every time the driver is unbound.
> 

The if statement make it safe to not be incremented when not needed. At
the end the `platform_device_release` will call the `of_node_put`.


-- 
Best regards,
Ronald

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-09-18  8:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  7:58 [PATCH v12 0/6] Add VIM4 MCU/FAN support Ronald Claveau via B4 Relay
2026-09-17  7:59 ` [PATCH v12 1/6] mfd: khadas-mcu: Add per-variant configuration infrastructure and VIM4 support Ronald Claveau via B4 Relay
2026-09-17  8:06   ` sashiko-bot
2026-09-17  7:59 ` [PATCH v12 2/6] mfd: khadas-mcu: Use MFD_CELL_* macros for cell declarations Ronald Claveau via B4 Relay
2026-09-17  8:07   ` sashiko-bot
2026-09-18  9:05   ` Neil Armstrong
2026-09-17  7:59 ` [PATCH v12 3/6] mfd: khadas-mcu: Add support for VIM4 MCU variant Ronald Claveau via B4 Relay
2026-09-17  8:11   ` sashiko-bot
2026-09-18  8:46     ` Ronald Claveau
2026-09-17  7:59 ` [PATCH v12 4/6] thermal: khadas-mcu-fan: Add fan config from platform data Add regulator support Ronald Claveau via B4 Relay
2026-09-17  8:13   ` sashiko-bot
2026-09-18  8:54     ` Ronald Claveau [this message]
2026-09-18  9:12   ` Daniel Lezcano
2026-09-17  7:59 ` [PATCH v12 5/6] arm64: dts: amlogic: t7: Add i2c controller node Ronald Claveau via B4 Relay
2026-09-17  8:03   ` sashiko-bot
2026-09-17  7:59 ` [PATCH v12 6/6] arm64: dts: amlogic: t7: khadas-vim4: Add i2c MCU fan node Ronald Claveau via B4 Relay
2026-09-17  8:08   ` sashiko-bot
2026-09-23 11:13 ` (subset) [PATCH v12 0/6] Add VIM4 MCU/FAN support Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1a28af11-54b9-48c3-a31c-85d9edb74af6@aliel.fr \
    --to=linux-kernel-dev@aliel.fr \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=mfd@lists.linux.dev \
    --cc=neil.armstrong@linaro.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®