Linux-i3c Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wentao Liang" <vulab@iscas.ac.cn>
Cc: Frank.Li@kernel.org, linux-i3c@lists.infradead.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH] i3c: master: Fix of_node reference leak in i3c_master_register()
Date: Wed, 16 Sep 2026 16:16:15 +0000	[thread overview]
Message-ID: <20260916161616.7B6B31F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260916160358.2081087-1-vulab@iscas.ac.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] i3c: API mismatch in error path leaves fwnode reference leaked on ACPI
--

commit b1e59a31437144668b1fb151fcdcb4359e796610
Author: Wentao Liang <vulab@iscas.ac.cn>

i3c: master: Fix of_node reference leak in i3c_master_register()

This commit attempts to fix a node reference leak in the error path of
i3c_master_register() when i3c_master_rpm_get() fails. It drops the reference
before device_initialize() is called.

> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index afcd7a21a3e66..1909d40387879 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -3685,8 +3685,10 @@ int i3c_master_register(struct i3c_master_controller *master,
>  	INIT_LIST_HEAD(&master->boardinfo.i3c);
>  
>  	ret = i3c_master_rpm_get(master);
> -	if (ret)
> +	if (ret) {
> +		of_node_put(master->dev.of_node);

[Severity: Medium]
Does this code correctly release the fwnode reference on non-DT systems like
ACPI?

The node for master->dev is acquired earlier in i3c_master_register() 
using the generic fwnode API:

	device_set_node(&master->dev, fwnode_handle_get(dev_fwnode(parent)));

Since of_node_put() only operates on Open Firmware nodes, won't this result in
a leaked reference on platforms utilizing ACPI or software nodes?

Should this use fwnode_handle_put(dev_fwnode(&master->dev)) instead, matching
the cleanup sequence implemented in i3c_masterdev_release()?

>  		return ret;
> +	}
>  
>  	device_initialize(&master->dev);
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916160358.2081087-1-vulab@iscas.ac.cn?part=1

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

  reply	other threads:[~2026-09-16 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 16:03 [PATCH] i3c: master: Fix of_node reference leak in i3c_master_register() Wentao Liang
2026-09-16 16:16 ` sashiko-bot [this message]
2026-09-16 20:03   ` Frank Li

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=20260916161616.7B6B31F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vulab@iscas.ac.cn \
    /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