Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Joshua Peisach" <jpeisach@ubuntu.com>
To: "Pengpeng Hou" <pengpeng@iscas.ac.cn>,
	"Sven Peter" <sven@kernel.org>, "Janne Grunau" <j@jannau.net>,
	"Neal Gompa" <neal@gompa.dev>, <asahi@lists.linux.dev>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] soc: apple: sart: require device link for consumers
Date: Tue, 16 Jun 2026 07:58:23 -0400	[thread overview]
Message-ID: <DJAGFE0RORK0.2HXY05SU7H3AF@ubuntu.com> (raw)
In-Reply-To: <20260616005346.7862-1-pengpeng@iscas.ac.cn>

On Mon Jun 15, 2026 at 8:53 PM EDT, Pengpeng Hou wrote:
> devm_apple_sart_get() obtains the supplier platform device and attempts
> to create a runtime-PM device link to it, but it ignores device_link_add()
> failure.  A consumer can then continue without the dependency that keeps
> the SART supplier ordered and runtime-PM reachable.
>
> Treat a failed device link as an error and drop the supplier device
> reference before returning.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
>  drivers/soc/apple/sart.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/apple/sart.c b/drivers/soc/apple/sart.c
> index 9eaf3febb382..66b99955b395 100644
> --- a/drivers/soc/apple/sart.c
> +++ b/drivers/soc/apple/sart.c
> @@ -218,6 +218,7 @@ struct apple_sart *devm_apple_sart_get(struct device *dev)
>  {
>  	struct device_node *sart_node;
>  	struct platform_device *sart_pdev;
> +	struct device_link *link;
>  	struct apple_sart *sart;
>  
>  	sart_node = of_parse_phandle(dev->of_node, "apple,sart", 0);
> @@ -236,8 +237,12 @@ struct apple_sart *devm_apple_sart_get(struct device *dev)
>  		return ERR_PTR(-EPROBE_DEFER);
>  	}
>  
> -	device_link_add(dev, &sart_pdev->dev,
> -			DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_SUPPLIER);
> +	link = device_link_add(dev, &sart_pdev->dev,
> +			       DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_SUPPLIER);
> +	if (!link) {
> +		put_device(&sart_pdev->dev);
> +		return ERR_PTR(-ENODEV);
> +	}
>  
>  	put_device(&sart_pdev->dev);
>  

I *think* this is okay...

Reviewed-by: Joshua Peisach <jpeisach@ubuntu.com>


      reply	other threads:[~2026-06-16 11:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16  0:53 [PATCH] soc: apple: sart: require device link for consumers Pengpeng Hou
2026-06-16 11:58 ` Joshua Peisach [this message]

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=DJAGFE0RORK0.2HXY05SU7H3AF@ubuntu.com \
    --to=jpeisach@ubuntu.com \
    --cc=asahi@lists.linux.dev \
    --cc=j@jannau.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neal@gompa.dev \
    --cc=pengpeng@iscas.ac.cn \
    --cc=sven@kernel.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