diff mbox

ARM: OMAP2+: Powerdomain: Fix unchecked dereference of arch_pwrdm

Message ID 1385553437-22568-1-git-send-email-rnayak@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rajendra Nayak Nov. 27, 2013, 11:57 a.m. UTC
Commit 'cd8abed' "ARM: OMAP2+: Powerdomain: Remove the need to
always have a voltdm associated to a pwrdm" leads to the following
Smatch complaint:

arch/arm/mach-omap2/powerdomain.c:131 _pwrdm_register()
	 error: we previously assumed 'arch_pwrdm' could be null (see line 105)

So, fix the unchecked dereference of arch_pwrdm.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
---
 arch/arm/mach-omap2/powerdomain.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Nishanth Menon Nov. 28, 2013, 1:55 a.m. UTC | #1
On 11/27/2013 05:57 AM, Rajendra Nayak wrote:
> Commit 'cd8abed' "ARM: OMAP2+: Powerdomain: Remove the need to
> always have a voltdm associated to a pwrdm" leads to the following
> Smatch complaint:
> 
> arch/arm/mach-omap2/powerdomain.c:131 _pwrdm_register()
> 	 error: we previously assumed 'arch_pwrdm' could be null (see line 105)
> 
> So, fix the unchecked dereference of arch_pwrdm.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> ---
>  arch/arm/mach-omap2/powerdomain.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
> index e233dfc..93a2a6e 100644
> --- a/arch/arm/mach-omap2/powerdomain.c
> +++ b/arch/arm/mach-omap2/powerdomain.c
> @@ -128,7 +128,8 @@ skip_voltdm:
>  	for (i = 0; i < pwrdm->banks; i++)
>  		pwrdm->ret_mem_off_counter[i] = 0;
>  
> -	arch_pwrdm->pwrdm_wait_transition(pwrdm);
> +	if (arch_pwrdm && arch_pwrdm->pwrdm_wait_transition)
> +		arch_pwrdm->pwrdm_wait_transition(pwrdm);
>  	pwrdm->state = pwrdm_read_pwrst(pwrdm);
>  	pwrdm->state_counter[pwrdm->state] = 1;
>  
> 
Acked-by: Nishanth Menon <nm@ti.com>
Tony Lindgren Dec. 2, 2013, 7:20 p.m. UTC | #2
* Nishanth Menon <nm@ti.com> [131127 17:56]:
> On 11/27/2013 05:57 AM, Rajendra Nayak wrote:
> > Commit 'cd8abed' "ARM: OMAP2+: Powerdomain: Remove the need to
> > always have a voltdm associated to a pwrdm" leads to the following
> > Smatch complaint:
> > 
> > arch/arm/mach-omap2/powerdomain.c:131 _pwrdm_register()
> > 	 error: we previously assumed 'arch_pwrdm' could be null (see line 105)
> > 
> > So, fix the unchecked dereference of arch_pwrdm.
> > 
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> > ---
> >  arch/arm/mach-omap2/powerdomain.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
> > index e233dfc..93a2a6e 100644
> > --- a/arch/arm/mach-omap2/powerdomain.c
> > +++ b/arch/arm/mach-omap2/powerdomain.c
> > @@ -128,7 +128,8 @@ skip_voltdm:
> >  	for (i = 0; i < pwrdm->banks; i++)
> >  		pwrdm->ret_mem_off_counter[i] = 0;
> >  
> > -	arch_pwrdm->pwrdm_wait_transition(pwrdm);
> > +	if (arch_pwrdm && arch_pwrdm->pwrdm_wait_transition)
> > +		arch_pwrdm->pwrdm_wait_transition(pwrdm);
> >  	pwrdm->state = pwrdm_read_pwrst(pwrdm);
> >  	pwrdm->state_counter[pwrdm->state] = 1;
> >  
> > 
> Acked-by: Nishanth Menon <nm@ti.com>

I'll queue this into omap-for-v3.13/fixes-take4.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" 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/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index e233dfc..93a2a6e 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -128,7 +128,8 @@  skip_voltdm:
 	for (i = 0; i < pwrdm->banks; i++)
 		pwrdm->ret_mem_off_counter[i] = 0;
 
-	arch_pwrdm->pwrdm_wait_transition(pwrdm);
+	if (arch_pwrdm && arch_pwrdm->pwrdm_wait_transition)
+		arch_pwrdm->pwrdm_wait_transition(pwrdm);
 	pwrdm->state = pwrdm_read_pwrst(pwrdm);
 	pwrdm->state_counter[pwrdm->state] = 1;