PM / Domains: remove unnecessary unlikely()
diff mbox series

Message ID 20190416162305.24375-1-tiny.windzz@gmail.com
State Awaiting Upstream
Delegated to: Rafael Wysocki
Headers show
Series
  • PM / Domains: remove unnecessary unlikely()
Related show

Commit Message

Frank Lee April 16, 2019, 4:23 p.m. UTC
WARN_ON() already contains an unlikely(), so it's not necessary to use
unlikely.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/base/power/domain.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Ulf Hansson April 17, 2019, 8:38 a.m. UTC | #1
On Tue, 16 Apr 2019 at 18:23, Yangtao Li <tiny.windzz@gmail.com> wrote:
>
> WARN_ON() already contains an unlikely(), so it's not necessary to use
> unlikely.
>
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/base/power/domain.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 96a6dc9d305c..598a4e02aee1 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -391,11 +391,9 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state)
>         if (unlikely(!genpd->set_performance_state))
>                 return -EINVAL;
>
> -       if (unlikely(!dev->power.subsys_data ||
> -                    !dev->power.subsys_data->domain_data)) {
> -               WARN_ON(1);
> +       if (WARN_ON(!dev->power.subsys_data ||
> +                    !dev->power.subsys_data->domain_data))
>                 return -EINVAL;
> -       }
>
>         genpd_lock(genpd);
>
> --
> 2.17.0
>
Rafael J. Wysocki May 1, 2019, 10:24 a.m. UTC | #2
On Wednesday, April 17, 2019 10:38:14 AM CEST Ulf Hansson wrote:
> On Tue, 16 Apr 2019 at 18:23, Yangtao Li <tiny.windzz@gmail.com> wrote:
> >
> > WARN_ON() already contains an unlikely(), so it's not necessary to use
> > unlikely.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> 
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
> 
> Kind regards
> Uffe
> 
> > ---
> >  drivers/base/power/domain.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> > index 96a6dc9d305c..598a4e02aee1 100644
> > --- a/drivers/base/power/domain.c
> > +++ b/drivers/base/power/domain.c
> > @@ -391,11 +391,9 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state)
> >         if (unlikely(!genpd->set_performance_state))
> >                 return -EINVAL;
> >
> > -       if (unlikely(!dev->power.subsys_data ||
> > -                    !dev->power.subsys_data->domain_data)) {
> > -               WARN_ON(1);
> > +       if (WARN_ON(!dev->power.subsys_data ||
> > +                    !dev->power.subsys_data->domain_data))
> >                 return -EINVAL;
> > -       }
> >
> >         genpd_lock(genpd);
> >
> > --
> > 2.17.0
> >
> 

Patch applied, thanks!

Patch
diff mbox series

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 96a6dc9d305c..598a4e02aee1 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -391,11 +391,9 @@  int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state)
 	if (unlikely(!genpd->set_performance_state))
 		return -EINVAL;
 
-	if (unlikely(!dev->power.subsys_data ||
-		     !dev->power.subsys_data->domain_data)) {
-		WARN_ON(1);
+	if (WARN_ON(!dev->power.subsys_data ||
+		     !dev->power.subsys_data->domain_data))
 		return -EINVAL;
-	}
 
 	genpd_lock(genpd);