[PATCH] interconnect: Do not create empty devres on missing interconnects

Krzysztof Kozlowski posted 1 patch 2 months ago
drivers/interconnect/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] interconnect: Do not create empty devres on missing interconnects
Posted by Krzysztof Kozlowski 2 months ago
of_icc_get() returns NULL on valid case - no interconnects - but no
need to create devres for that, because it just wastes memory without
any use/benefits.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 drivers/interconnect/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index 8569b78a1851..ce572c62f58f 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -432,7 +432,7 @@ struct icc_path *devm_of_icc_get(struct device *dev, const char *name)
 		return ERR_PTR(-ENOMEM);
 
 	path = of_icc_get(dev, name);
-	if (!IS_ERR(path)) {
+	if (!IS_ERR_OR_NULL(path)) {
 		*ptr = path;
 		devres_add(dev, ptr);
 	} else {
-- 
2.51.0
Re: [PATCH] interconnect: Do not create empty devres on missing interconnects
Posted by Kuan-Wei Chiu 2 months ago
On Thu, Apr 16, 2026 at 03:09:13PM +0200, Krzysztof Kozlowski wrote:
> of_icc_get() returns NULL on valid case - no interconnects - but no
> need to create devres for that, because it just wastes memory without
> any use/benefits.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>

Regards,
Kuan-Wei

> ---
>  drivers/interconnect/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
> index 8569b78a1851..ce572c62f58f 100644
> --- a/drivers/interconnect/core.c
> +++ b/drivers/interconnect/core.c
> @@ -432,7 +432,7 @@ struct icc_path *devm_of_icc_get(struct device *dev, const char *name)
>  		return ERR_PTR(-ENOMEM);
>  
>  	path = of_icc_get(dev, name);
> -	if (!IS_ERR(path)) {
> +	if (!IS_ERR_OR_NULL(path)) {
>  		*ptr = path;
>  		devres_add(dev, ptr);
>  	} else {
> -- 
> 2.51.0
> 
>