diff mbox

PM / OPP: fix incorrect OPP count handling in of_init_opp_table

Message ID 1400237477-24831-1-git-send-email-chander.kashyap@linaro.org
State Accepted
Commit 086abb58590a4df73e8a6ed71fd418826937cd46
Headers show

Commit Message

Chander Kashyap May 16, 2014, 10:51 a.m. UTC
In of_init_opp_table function, if a failure to add an OPP is
detected, the count of OPPs, yet to be added is not updated.
Fix this by decrementing this count on failure as well.

Signed-off-by: Chander Kashyap <k.chander@samsung.com>
Signed-off-by: Inderpal Singh <inderpal.s@samsung.com>
---
 drivers/base/power/opp.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Viresh Kumar May 16, 2014, 11:13 a.m. UTC | #1
On 16 May 2014 16:21, Chander Kashyap <chander.kashyap@linaro.org> wrote:
> In of_init_opp_table function, if a failure to add an OPP is
> detected, the count of OPPs, yet to be added is not updated.
> Fix this by decrementing this count on failure as well.
>
> Signed-off-by: Chander Kashyap <k.chander@samsung.com>
> Signed-off-by: Inderpal Singh <inderpal.s@samsung.com>
> ---
>  drivers/base/power/opp.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki May 16, 2014, 11:03 p.m. UTC | #2
On Friday, May 16, 2014 04:43:31 PM Viresh Kumar wrote:
> On 16 May 2014 16:21, Chander Kashyap <chander.kashyap@linaro.org> wrote:
> > In of_init_opp_table function, if a failure to add an OPP is
> > detected, the count of OPPs, yet to be added is not updated.
> > Fix this by decrementing this count on failure as well.
> >
> > Signed-off-by: Chander Kashyap <k.chander@samsung.com>
> > Signed-off-by: Inderpal Singh <inderpal.s@samsung.com>
> > ---
> >  drivers/base/power/opp.c |    4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Is this -stable material?  If so, which -stable?
Viresh Kumar May 17, 2014, 4:54 a.m. UTC | #3
On 17 May 2014 04:33, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> Is this -stable material?  If so, which -stable?

3.7+
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nishanth Menon May 19, 2014, 1:04 p.m. UTC | #4
On Fri, May 16, 2014 at 5:51 AM, Chander Kashyap
<chander.kashyap@linaro.org> wrote:
> In of_init_opp_table function, if a failure to add an OPP is
> detected, the count of OPPs, yet to be added is not updated.
> Fix this by decrementing this count on failure as well.
>
> Signed-off-by: Chander Kashyap <k.chander@samsung.com>
> Signed-off-by: Inderpal Singh <inderpal.s@samsung.com>
> ---
>  drivers/base/power/opp.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
> index d9e376a..faae9cf 100644
> --- a/drivers/base/power/opp.c
> +++ b/drivers/base/power/opp.c
> @@ -643,11 +643,9 @@ int of_init_opp_table(struct device *dev)
>                 unsigned long freq = be32_to_cpup(val++) * 1000;
>                 unsigned long volt = be32_to_cpup(val++);
>
> -               if (dev_pm_opp_add(dev, freq, volt)) {
> +               if (dev_pm_opp_add(dev, freq, volt))
>                         dev_warn(dev, "%s: Failed to add OPP %ld\n",
>                                  __func__, freq);
> -                       continue;
> -               }
>                 nr -= 2;
>         }
Good Catch. Thanks.

Acked-by: Nishanth Menon <nm@ti.com>

--
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki May 19, 2014, 11:26 p.m. UTC | #5
On Monday, May 19, 2014 08:04:30 AM Nishanth Menon wrote:
> On Fri, May 16, 2014 at 5:51 AM, Chander Kashyap
> <chander.kashyap@linaro.org> wrote:
> > In of_init_opp_table function, if a failure to add an OPP is
> > detected, the count of OPPs, yet to be added is not updated.
> > Fix this by decrementing this count on failure as well.
> >
> > Signed-off-by: Chander Kashyap <k.chander@samsung.com>
> > Signed-off-by: Inderpal Singh <inderpal.s@samsung.com>
> > ---
> >  drivers/base/power/opp.c |    4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
> > index d9e376a..faae9cf 100644
> > --- a/drivers/base/power/opp.c
> > +++ b/drivers/base/power/opp.c
> > @@ -643,11 +643,9 @@ int of_init_opp_table(struct device *dev)
> >                 unsigned long freq = be32_to_cpup(val++) * 1000;
> >                 unsigned long volt = be32_to_cpup(val++);
> >
> > -               if (dev_pm_opp_add(dev, freq, volt)) {
> > +               if (dev_pm_opp_add(dev, freq, volt))
> >                         dev_warn(dev, "%s: Failed to add OPP %ld\n",
> >                                  __func__, freq);
> > -                       continue;
> > -               }
> >                 nr -= 2;
> >         }
> Good Catch. Thanks.
> 
> Acked-by: Nishanth Menon <nm@ti.com>

Since my pull request for 3.15-rc6 has been sent already, I'm going to push
this for -rc7.  Thanks!
diff mbox

Patch

diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index d9e376a..faae9cf 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -643,11 +643,9 @@  int of_init_opp_table(struct device *dev)
 		unsigned long freq = be32_to_cpup(val++) * 1000;
 		unsigned long volt = be32_to_cpup(val++);
 
-		if (dev_pm_opp_add(dev, freq, volt)) {
+		if (dev_pm_opp_add(dev, freq, volt))
 			dev_warn(dev, "%s: Failed to add OPP %ld\n",
 				 __func__, freq);
-			continue;
-		}
 		nr -= 2;
 	}