Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Roman Vivchar" <rva333@protonmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 2/3] soc: mediatek: pwrap: use correct log level
Date: Wed, 15 Jul 2026 12:36:34 +0000	[thread overview]
Message-ID: <20260715123634.A525F1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260715-6572-pwrap-v2-2-bea1d801c81b@protonmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Child devices created by `of_platform_populate()` are not cleaned up on driver unbind, leading to orphaned devices and potential Use-After-Free.
--

--- Patch [2]: [PATCH v2 2/3] soc: mediatek: pwrap: use correct log level ---
commit ce26f7b3ff3bc3d17adce977d882bf0f6118ba23
Author: Roman Vivchar <rva333@protonmail.com>

soc: mediatek: pwrap: use correct log level

This commit simplifies the error paths in the pwrap driver probe function
by replacing dev_dbg calls with dev_err_probe, ensuring the correct log
level is used on failure.

> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c

[ ... ]

> @@ -2593,11 +2584,9 @@ static int pwrap_probe(struct platform_device *pdev)
>  		return PTR_ERR(wrp->regmap);
>  
>  	ret = of_platform_populate(np, NULL, NULL, wrp->dev);

[Severity: High]
This is a pre-existing issue, but does this code leave child devices
populated on driver unbind?

Since devm_regmap_init() is used earlier, the regmap will be automatically
freed when the driver unbinds. If devm_of_platform_populate() isn't used
here, will child PMIC drivers remain bound and attempt to use the freed
parent regmap, leading to a use-after-free?

> -	if (ret) {
> -		dev_dbg(wrp->dev, "failed to create child devices at %pOF\n",
> -				np);
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(wrp->dev, ret,
> +				     "failed to create child devices at %pOF\n", np);
>  
>  	return 0;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715-6572-pwrap-v2-0-bea1d801c81b@protonmail.com?part=2

  reply	other threads:[~2026-07-15 12:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 12:26 [PATCH v2 0/3] soc: mediatek: pwrap: mt6572 support + log level fixes Roman Vivchar via B4 Relay
2026-07-15 12:26 ` [PATCH v2 1/3] dt-bindings: soc: mediatek: pwrap: add mt6572 Roman Vivchar via B4 Relay
2026-07-15 12:26 ` [PATCH v2 2/3] soc: mediatek: pwrap: use correct log level Roman Vivchar via B4 Relay
2026-07-15 12:36   ` sashiko-bot [this message]
2026-07-15 12:26 ` [PATCH v2 3/3] soc: mediatek: pwrap: add mt6572 support Roman Vivchar via B4 Relay
2026-07-15 12:47   ` sashiko-bot
2026-07-15 13:22   ` AngeloGioacchino Del Regno

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=20260715123634.A525F1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=rva333@protonmail.com \
    --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