Linux ATA/IDE development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rosen Penev" <rosenp@gmail.com>
Cc: cassel@kernel.org, linux-ide@vger.kernel.org, dlemoal@kernel.org
Subject: Re: [PATCH] ata: libahci_platform: use of_platform_device_create() return value
Date: Thu, 09 Jul 2026 01:50:21 +0000	[thread overview]
Message-ID: <20260709015021.BC6D91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709014230.1905756-1-rosenp@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Using the return value of `of_platform_device_create()` breaks target regulator fetching during driver rebind or probe deferral, leading to unpowered SATA ports.
--

--- Patch [1]: [PATCH] ata: libahci_platform: use of_platform_device_create() return value ---
commit b10e7693c196a90e6a36f9889202414e7cb20fc9
Author: Rosen Penev <rosenp@gmail.com>

ata: libahci_platform: use of_platform_device_create() return value

This commit updates ahci_platform_get_resources() to use the return value
of of_platform_device_create() directly, removing the subsequent call to
of_find_device_by_node() to avoid needing to free the reference.

> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -617,10 +617,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
>  			mask_port_map |= BIT(port);
>  
>  #ifdef CONFIG_OF_ADDRESS
> -			of_platform_device_create(child, NULL, NULL);
> -
> -			port_dev = of_find_device_by_node(child);
> -
> +			port_dev = of_platform_device_create(child, NULL, NULL);
>  			if (port_dev) {
>  				rc = ahci_platform_get_regulator(hpriv, port,
>  								&port_dev->dev);

[Severity: High]
Does this change break regulator fetching during a probe deferral?

When of_platform_device_create() successfully creates the device on the first
probe attempt, it sets the OF_POPULATED flag on the child device node.

If a subsequent initialization step triggers a probe deferral (for instance,
returning -EPROBE_DEFER), the probe is aborted. However, the driver's cleanup
path does not depopulate the platform device, so the OF_POPULATED flag remains
set on the child node.

During the second probe attempt, of_platform_device_create() sees the
OF_POPULATED flag and returns NULL.

Because port_dev is now NULL, the block above is bypassed, and
ahci_platform_get_regulator() is silently skipped. This leaves the SATA port
without its required target power regulator.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260709014230.1905756-1-rosenp@gmail.com?part=1

  parent reply	other threads:[~2026-07-09  1:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09  1:42 [PATCH] ata: libahci_platform: use of_platform_device_create() return value Rosen Penev
2026-07-09  1:46 ` Damien Le Moal
2026-07-09  1:50 ` sashiko-bot [this message]
2026-07-09  1:59   ` Rosen Penev
2026-07-09  2:00     ` Damien Le Moal
2026-07-09  2:01       ` Rosen Penev

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=20260709015021.BC6D91F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=rosenp@gmail.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