Linux-i3c Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lakshay Piplani" <lakshay.piplani@nxp.com>,
	linux-i3c@lists.infradead.org, mfd@lists.linux.dev
Cc: Frank.Li@kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	lee@kernel.org
Subject: Re: [PATCH v21 2/4] regulator: p3h2x4x: Add driver for on-die regulators in NXP P3H2x4x i3c hub
Date: Thu, 12 Nov 2026 12:56:22 +0000	[thread overview]
Message-ID: <sashiko-outbox-211123@kernel.org> (raw)
In-Reply-To: <20261112124437.3367252-3-lakshay.piplani@nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] regulator: p3h2x4x: OF node leak in p3h2x4x_regulator_probe()
--

commit 0c22fd7becea5c3dad0894cb83a63e3d27c04c45
Author: Aman Kumar Pandey <aman.kumarpandey@nxp.com>

regulator: p3h2x4x: Add driver for on-die regulators in NXP P3H2x4x i3c hub

This commit adds a regulator driver for the four on-die LDOs in the NXP
P3H2x4x I3C hub family, registered as a child of the MFD device.

> diff --git a/drivers/regulator/p3h2840_i3c_hub_regulator.c b/drivers/regulator/p3h2840_i3c_hub_regulator.c
> new file mode 100644
> index 0000000000000..244f2a4f70f38
> --- /dev/null
> +++ b/drivers/regulator/p3h2840_i3c_hub_regulator.c

[ ... ]

> +static int p3h2x4x_regulator_probe(struct platform_device *pdev)
> +{
> +	struct p3h2x4x *p3h2x4x = dev_get_drvdata(pdev->dev.parent);
> +	struct p3h2x4x_regulator_dev *p3h2x4x_regulator;
> +	struct regulator_config rcfg = { };
> +	struct device *dev = &pdev->dev;
> +	struct regulator_dev *rdev;
> +	int i;
> +
> +	p3h2x4x_regulator = devm_kzalloc(dev, sizeof(*p3h2x4x_regulator), GFP_KERNEL);
> +	if (!p3h2x4x_regulator)
> +		return -ENOMEM;
> +
> +	p3h2x4x_regulator->p3h2x4x = p3h2x4x;
> +	p3h2x4x_regulator->regmap = p3h2x4x->regmap;
> +
> +	platform_set_drvdata(pdev, p3h2x4x_regulator);
> +
> +	device_set_of_node_from_dev(dev, dev->parent);

[Severity: Medium]
Does calling device_set_of_node_from_dev() here leak a reference on
dev->parent->of_node when pdev is unregistered?

The MFD cell for p3h2x4x-regulator does not set of_compatible or swnode, so
mfd_add_device() allocates pdev with dev.fwnode set to NULL.
device_set_of_node_from_dev() takes a reference on dev->parent->of_node and
assigns dev->of_node without updating dev->fwnode, whereas
platform_device_release() drops the firmware node reference via
fwnode_handle_put(pa->pdev.dev.fwnode).

Using platform_device_set_of_node_from_dev(pdev, dev->parent) sets both
dev.of_node and dev.fwnode so platform_device_release() balances the
reference.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112124437.3367252-1-lakshay.piplani@nxp.com?part=2

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

  reply	other threads:[~2026-11-12 12:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 12:44 [PATCH v21 0/4] Add support for NXP P3H2x4x I3C hub driver Lakshay Piplani
2026-11-12 12:44 ` [PATCH v21 1/4] mfd: p3h2x4x: Add driver for NXP P3H2x4x i3c hub and on-die regulator Lakshay Piplani
2026-11-12 12:54   ` sashiko-bot
2026-11-12 12:44 ` [PATCH v21 2/4] regulator: p3h2x4x: Add driver for on-die regulators in NXP P3H2x4x i3c hub Lakshay Piplani
2026-11-12 12:56   ` sashiko-bot [this message]
2026-11-12 12:44 ` [PATCH v21 3/4] i3c: hub: p3h2x4x: Add support for NXP P3H2x4x I3C hub functionality Lakshay Piplani
2026-11-12 13:15   ` sashiko-bot
2026-11-12 12:44 ` [PATCH v21 4/4] i3c: hub: p3h2x4x: Add SMBus slave mode support Lakshay Piplani
2026-11-12 13:07   ` sashiko-bot

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=sashiko-outbox-211123@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=lakshay.piplani@nxp.com \
    --cc=lee@kernel.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=mfd@lists.linux.dev \
    --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