* [PATCH] soc: apple: sart: require device link for consumers
@ 2026-06-16 0:53 Pengpeng Hou
2026-06-16 11:58 ` Joshua Peisach
0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-16 0:53 UTC (permalink / raw)
To: Sven Peter, Janne Grunau, Neal Gompa, asahi, linux-arm-kernel,
linux-kernel
Cc: Pengpeng Hou
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);
--
2.50.1 (Apple Git-155)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] soc: apple: sart: require device link for consumers
2026-06-16 0:53 [PATCH] soc: apple: sart: require device link for consumers Pengpeng Hou
@ 2026-06-16 11:58 ` Joshua Peisach
0 siblings, 0 replies; 2+ messages in thread
From: Joshua Peisach @ 2026-06-16 11:58 UTC (permalink / raw)
To: Pengpeng Hou, Sven Peter, Janne Grunau, Neal Gompa, asahi,
linux-arm-kernel, linux-kernel
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-16 11:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-16 0:53 [PATCH] soc: apple: sart: require device link for consumers Pengpeng Hou
2026-06-16 11:58 ` Joshua Peisach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox