diff mbox

ARM: OMAP2+: timer: initialize before using oh_name

Message ID 1369722288-15592-1-git-send-email-afzal@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Afzal Mohammed May 28, 2013, 6:24 a.m. UTC
of_property_read_string_index(...,&oh_name) in omap_dm_timer_init_one
does not alter the value of 'oh_name' even if the relevant function
fails and as 'oh_name' in stack may have a non-zero value, it would
be misunderstood by timer code that DT has specified "ti,hwmod"
property for timer. 'oh_name' in this scenario would be a junk value,
this would result in module not being enabled by hwmod API's for
timer, and in turn crash.

Signed-off-by: Afzal Mohammed <afzal@ti.com>
---
 arch/arm/mach-omap2/timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jon Hunter May 28, 2013, 9:20 p.m. UTC | #1
On 28/05/13 07:24, Afzal Mohammed wrote:
> of_property_read_string_index(...,&oh_name) in omap_dm_timer_init_one
> does not alter the value of 'oh_name' even if the relevant function
> fails and as 'oh_name' in stack may have a non-zero value, it would
> be misunderstood by timer code that DT has specified "ti,hwmod"
> property for timer. 'oh_name' in this scenario would be a junk value,
> this would result in module not being enabled by hwmod API's for
> timer, and in turn crash.
> 
> Signed-off-by: Afzal Mohammed <afzal@ti.com>
> ---
>  arch/arm/mach-omap2/timer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
> index f8b23b8..8e0c390 100644
> --- a/arch/arm/mach-omap2/timer.c
> +++ b/arch/arm/mach-omap2/timer.c
> @@ -220,7 +220,7 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
>  					 int posted)
>  {
>  	char name[10]; /* 10 = sizeof("gptXX_Xck0") */
> -	const char *oh_name;
> +	const char *oh_name = NULL;
>  	struct device_node *np;
>  	struct omap_hwmod *oh;
>  	struct resource irq, mem;

Thanks!

Acked-by: Jon Hunter <jgchunter@gmail.com>

Cheers
Jon

--
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
Tony Lindgren July 4, 2013, 11:47 a.m. UTC | #2
* Jon Hunter <jgchunter@gmail.com> [130528 14:26]:
> 
> On 28/05/13 07:24, Afzal Mohammed wrote:
> > of_property_read_string_index(...,&oh_name) in omap_dm_timer_init_one
> > does not alter the value of 'oh_name' even if the relevant function
> > fails and as 'oh_name' in stack may have a non-zero value, it would
> > be misunderstood by timer code that DT has specified "ti,hwmod"
> > property for timer. 'oh_name' in this scenario would be a junk value,
> > this would result in module not being enabled by hwmod API's for
> > timer, and in turn crash.
> > 
> > Signed-off-by: Afzal Mohammed <afzal@ti.com>
> > ---
> >  arch/arm/mach-omap2/timer.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
> > index f8b23b8..8e0c390 100644
> > --- a/arch/arm/mach-omap2/timer.c
> > +++ b/arch/arm/mach-omap2/timer.c
> > @@ -220,7 +220,7 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
> >  					 int posted)
> >  {
> >  	char name[10]; /* 10 = sizeof("gptXX_Xck0") */
> > -	const char *oh_name;
> > +	const char *oh_name = NULL;
> >  	struct device_node *np;
> >  	struct omap_hwmod *oh;
> >  	struct resource irq, mem;
> 
> Thanks!
> 
> Acked-by: Jon Hunter <jgchunter@gmail.com>

Thanks, applying into omap-for-v3.11/fixes.

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/timer.c b/arch/arm/mach-omap2/timer.c
index f8b23b8..8e0c390 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -220,7 +220,7 @@  static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 					 int posted)
 {
 	char name[10]; /* 10 = sizeof("gptXX_Xck0") */
-	const char *oh_name;
+	const char *oh_name = NULL;
 	struct device_node *np;
 	struct omap_hwmod *oh;
 	struct resource irq, mem;