* [PATCH] opp: Fix error check in dev_pm_opp_attach_genpd()
@ 2022-05-24 12:31 Tang Bin
2022-05-25 6:47 ` Viresh Kumar
0 siblings, 1 reply; 2+ messages in thread
From: Tang Bin @ 2022-05-24 12:31 UTC (permalink / raw)
To: vireshk, nm, sboyd; +Cc: linux-pm, linux-kernel, Tang Bin
dev_pm_domain_attach_by_name() may return NULL in some cases,
so IS_ERR() doesn't meet the requirements. Thus fix it.
Fixes: 6319aee10e53 ("opp: Attach genpds to devices from within OPP core")
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
drivers/opp/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 2945f3c1c..56cae6ee2 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -2409,8 +2409,8 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev,
}
virt_dev = dev_pm_domain_attach_by_name(dev, *name);
- if (IS_ERR(virt_dev)) {
- ret = PTR_ERR(virt_dev);
+ if (IS_ERR_OR_NULL(virt_dev)) {
+ ret = PTR_ERR(virt_dev) ? : -ENODATA;
dev_err(dev, "Couldn't attach to pm_domain: %d\n", ret);
goto err;
}
--
2.20.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] opp: Fix error check in dev_pm_opp_attach_genpd()
2022-05-24 12:31 [PATCH] opp: Fix error check in dev_pm_opp_attach_genpd() Tang Bin
@ 2022-05-25 6:47 ` Viresh Kumar
0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2022-05-25 6:47 UTC (permalink / raw)
To: Tang Bin; +Cc: vireshk, nm, sboyd, linux-pm, linux-kernel
On 24-05-22, 20:31, Tang Bin wrote:
> dev_pm_domain_attach_by_name() may return NULL in some cases,
> so IS_ERR() doesn't meet the requirements. Thus fix it.
>
> Fixes: 6319aee10e53 ("opp: Attach genpds to devices from within OPP core")
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
> drivers/opp/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 2945f3c1c..56cae6ee2 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -2409,8 +2409,8 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev,
> }
>
> virt_dev = dev_pm_domain_attach_by_name(dev, *name);
> - if (IS_ERR(virt_dev)) {
> - ret = PTR_ERR(virt_dev);
> + if (IS_ERR_OR_NULL(virt_dev)) {
> + ret = PTR_ERR(virt_dev) ? : -ENODATA;
I have changed this to ENODEV instead.
> dev_err(dev, "Couldn't attach to pm_domain: %d\n", ret);
> goto err;
> }
Applied. Thanks.
--
viresh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-25 6:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24 12:31 [PATCH] opp: Fix error check in dev_pm_opp_attach_genpd() Tang Bin
2022-05-25 6:47 ` Viresh Kumar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.