Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chen-Yu Tsai" <wenst@chromium.org>
Cc: devicetree@vger.kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 5/6] regulator: mt6359: Add regulator supply names
Date: Wed, 13 May 2026 20:34:17 +0000	[thread overview]
Message-ID: <20260513203418.51058C2BCFB@smtp.kernel.org> (raw)
In-Reply-To: <20260512085358.1693208-6-wenst@chromium.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Redundant memory allocation for `vbbck` regulator description due to hardcoded supply name mismatch.
--

commit 71212b8ad317d34fab479d1bb93b102697d370d4
Author: Chen-Yu Tsai <wenst@chromium.org>

regulator: mt6359: Add regulator supply names

This commit adds .supply_name field settings for each MT6359 regulator to
match the DT binding definitions. It also handles dynamic supply name
assignment for the vbbck regulator which is fed by vio18.

> diff --git a/drivers/regulator/mt6359-regulator.c b/drivers/regulator/mt6359-regulator.c
> index bcf9a476a34e1..fa97c3189df5d 100644
> --- a/drivers/regulator/mt6359-regulator.c
> +++ b/drivers/regulator/mt6359-regulator.c
[ ... ]
> @@ -641,11 +649,12 @@ static const struct mt6359_regulator_info mt6359_regulators[] = {
[ ... ]
> -	MT6359_LDO("ldo_vbbck", VBBCK, vbbck_voltages,
> +	/* vbbck is fed from vio18 internally. */
> +	MT6359_LDO("ldo_vbbck", VBBCK, "LDO_VIO18", vbbck_voltages,
>  		   MT6359_RG_LDO_VBBCK_EN_ADDR, MT6359_RG_LDO_VBBCK_EN_SHIFT,

Would setting the supply name here to "VIO18" instead of "LDO_VIO18" be
more accurate?

The MT6359_LDO macro sets the default name for the VIO18 regulator to
"VIO18" using the stringified #_name argument. Because this is initialized
to "LDO_VIO18", it seems to guarantee a mismatch during the probe check:

[ ... ]
> @@ -951,6 +959,7 @@ static int mt6359_regulator_probe(struct platform_device *pdev)
[ ... ]
> +	vio18_name = mt6359_info[MT6359_ID_VIO18].desc.name;
> +
>  	config.dev = mt6397->dev;
>  	config.regmap = mt6397->regmap;
>  	for (i = 0; i < MT6359_MAX_REGULATOR; i++, mt6359_info++) {
> +		const struct regulator_desc *desc = &mt6359_info->desc;
> +		struct regulator_desc *_desc;
> +
>  		/* drop const here, but all uses in the driver are const */
>  		config.driver_data = (void *)mt6359_info;
> -		rdev = devm_regulator_register(&pdev->dev, &mt6359_info->desc, &config);
> +
> +		/* Use vio18's actual name as supply_name for vbbck */
> +		if (i == MT6359_ID_VBBCK && strcmp(desc->supply_name, vio18_name) != 0) {
> +			_desc = devm_kzalloc(&pdev->dev, sizeof(*_desc), GFP_KERNEL);

Since desc->supply_name is "LDO_VIO18" and vio18_name defaults to "VIO18",
does this cause an unnecessary allocation of a new regulator_desc on every
boot, even when the device tree doesn't override the VIO18 name?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260512085358.1693208-1-wenst@chromium.org?part=5

  reply	other threads:[~2026-05-13 20:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  8:53 [PATCH v3 0/6] regulator: mt6359: cleanup and add supplies Chen-Yu Tsai
2026-05-12  8:53 ` [PATCH v3 1/6] mfd: dt-bindings: mt6397: Add regulator supplies Chen-Yu Tsai
2026-05-13 19:37   ` sashiko-bot
2026-05-12  8:53 ` [PATCH v3 2/6] regulator: dt-bindings: mt6359: Drop regulator-name pattern restrictions Chen-Yu Tsai
2026-05-12  8:53 ` [PATCH v3 3/6] regulator: dt-bindings: mt6359: Deprecate bogus vcn33_[12]_* split regulators Chen-Yu Tsai
2026-05-13 19:52   ` sashiko-bot
2026-05-12  8:53 ` [PATCH v3 4/6] regulator: mt6359: const-ify regulator descriptions Chen-Yu Tsai
2026-05-12  8:53 ` [PATCH v3 5/6] regulator: mt6359: Add regulator supply names Chen-Yu Tsai
2026-05-13 20:34   ` sashiko-bot [this message]
2026-05-12  8:53 ` [PATCH v3 6/6] regulator: mt6359: Add proper ldo_vcn33_[12] regulators Chen-Yu Tsai
2026-05-13 20:59   ` 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=20260513203418.51058C2BCFB@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wenst@chromium.org \
    /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