diff mbox

[BUG,FIX] PM / cpu_domains: Check for NULL callbacks

Message ID 1456866931-37851-2-git-send-email-lina.iyer@linaro.org (mailing list archive)
State RFC
Headers show

Commit Message

Lina Iyer March 1, 2016, 9:15 p.m. UTC
Check for NULL platform callback before calling.

Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
---
 drivers/base/power/cpu_domains.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Lina Iyer March 1, 2016, 9:17 p.m. UTC | #1
Ignore this patch pls. This change has been folded in.

Thanks,
Lina

On Tue, Mar 01 2016 at 14:15 -0700, Lina Iyer wrote:
>Check for NULL platform callback before calling.
>
>Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
>---
> drivers/base/power/cpu_domains.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/base/power/cpu_domains.c b/drivers/base/power/cpu_domains.c
>index 7069411..bcaa474 100644
>--- a/drivers/base/power/cpu_domains.c
>+++ b/drivers/base/power/cpu_domains.c
>@@ -157,16 +157,22 @@ static int cpu_pd_power_on(struct generic_pm_domain *genpd)
> {
> 	struct cpu_pm_domain *pd = to_cpu_pd(genpd);
>
>-	return pd->ops.power_on();
>+	if (pd->ops.power_on)
>+		return pd->ops.power_on();
>+
>+	return 0;
> }
>
> static int cpu_pd_power_off(struct generic_pm_domain *genpd)
> {
> 	struct cpu_pm_domain *pd = to_cpu_pd(genpd);
>
>-	return pd->ops.power_off(genpd->state_idx,
>+	if (pd->ops.power_off)
>+		return pd->ops.power_off(genpd->state_idx,
> 			genpd->states[genpd->state_idx].param,
> 			pd->cpus);
>+
>+	return 0;
> }
>
> /**
>-- 
>2.1.4
>
--
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
diff mbox

Patch

diff --git a/drivers/base/power/cpu_domains.c b/drivers/base/power/cpu_domains.c
index 7069411..bcaa474 100644
--- a/drivers/base/power/cpu_domains.c
+++ b/drivers/base/power/cpu_domains.c
@@ -157,16 +157,22 @@  static int cpu_pd_power_on(struct generic_pm_domain *genpd)
 {
 	struct cpu_pm_domain *pd = to_cpu_pd(genpd);
 
-	return pd->ops.power_on();
+	if (pd->ops.power_on)
+		return pd->ops.power_on();
+
+	return 0;
 }
 
 static int cpu_pd_power_off(struct generic_pm_domain *genpd)
 {
 	struct cpu_pm_domain *pd = to_cpu_pd(genpd);
 
-	return pd->ops.power_off(genpd->state_idx,
+	if (pd->ops.power_off)
+		return pd->ops.power_off(genpd->state_idx,
 			genpd->states[genpd->state_idx].param,
 			pd->cpus);
+
+	return 0;
 }
 
 /**