Re: [PATCH 7/7] arm: omap2: clksel: fix compile warning

2011-01-19 Thread Tony Lindgren
* Felipe Balbi  [110117 00:18]:
> Hi,
> 
> On Mon, Jan 17, 2011 at 01:37:41PM +0530, Varadarajan, Charulatha wrote:
> > On Mon, Jan 17, 2011 at 10:01, Felipe Balbi  wrote:
> > > Fix the following compile warning:
> > > arch/arm/mach-omap2/clkt_clksel.c: In function '_get_div_and_fieldval':
> > > arch/arm/mach-omap2/clkt_clksel.c:100:35: warning: 'max_clkr' may be
> > > used uninitialized in this function
> > >
> > > While at that, also add a check to avoid using max_clkr while NULL.
> > >
> > > Signed-off-by: Felipe Balbi 
> > > ---
> > >  arch/arm/mach-omap2/clkt_clksel.c |    5 -
> > >  1 files changed, 4 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/arch/arm/mach-omap2/clkt_clksel.c 
> > > b/arch/arm/mach-omap2/clkt_clksel.c
> > > index a781cd6..baf0b6b 100644
> > > --- a/arch/arm/mach-omap2/clkt_clksel.c
> > > +++ b/arch/arm/mach-omap2/clkt_clksel.c
> > > @@ -97,7 +97,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, 
> > > struct clk *clk,
> > >                                u32 *field_val)
> > >  {
> > >        const struct clksel *clks;
> > > -       const struct clksel_rate *clkr, *max_clkr;
> > > +       const struct clksel_rate *clkr, *max_clkr = NULL;
> > >        u8 max_div = 0;
> > >
> > >        clks = _get_clksel_by_parent(clk, src_clk);
> > > @@ -123,6 +123,9 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, 
> > > struct clk *clk,
> > >                }
> > >        }
> > >
> > > +       if (!max_clkr)
> > > +               return 0;
> > 
> > Would it be more appropriate to move this check after the "if" check
> > of max_div==0 and it's warning?
> > or add a warning before it returns?
> 
> Maybe this return isn't even necessary. max_clkr will be true if max_div
> is valid, so they cancel each other.
> 
> Tony ?

Looks like the max_div test should catch it to me. Paul?

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 7/7] arm: omap2: clksel: fix compile warning

2011-01-17 Thread Felipe Balbi
Hi,

On Mon, Jan 17, 2011 at 01:37:41PM +0530, Varadarajan, Charulatha wrote:
> On Mon, Jan 17, 2011 at 10:01, Felipe Balbi  wrote:
> > Fix the following compile warning:
> > arch/arm/mach-omap2/clkt_clksel.c: In function '_get_div_and_fieldval':
> > arch/arm/mach-omap2/clkt_clksel.c:100:35: warning: 'max_clkr' may be
> > used uninitialized in this function
> >
> > While at that, also add a check to avoid using max_clkr while NULL.
> >
> > Signed-off-by: Felipe Balbi 
> > ---
> >  arch/arm/mach-omap2/clkt_clksel.c |    5 -
> >  1 files changed, 4 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/clkt_clksel.c 
> > b/arch/arm/mach-omap2/clkt_clksel.c
> > index a781cd6..baf0b6b 100644
> > --- a/arch/arm/mach-omap2/clkt_clksel.c
> > +++ b/arch/arm/mach-omap2/clkt_clksel.c
> > @@ -97,7 +97,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, 
> > struct clk *clk,
> >                                u32 *field_val)
> >  {
> >        const struct clksel *clks;
> > -       const struct clksel_rate *clkr, *max_clkr;
> > +       const struct clksel_rate *clkr, *max_clkr = NULL;
> >        u8 max_div = 0;
> >
> >        clks = _get_clksel_by_parent(clk, src_clk);
> > @@ -123,6 +123,9 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, 
> > struct clk *clk,
> >                }
> >        }
> >
> > +       if (!max_clkr)
> > +               return 0;
> 
> Would it be more appropriate to move this check after the "if" check
> of max_div==0 and it's warning?
> or add a warning before it returns?

Maybe this return isn't even necessary. max_clkr will be true if max_div
is valid, so they cancel each other.

Tony ?

-- 
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 7/7] arm: omap2: clksel: fix compile warning

2011-01-17 Thread Varadarajan, Charulatha
On Mon, Jan 17, 2011 at 10:01, Felipe Balbi  wrote:
> Fix the following compile warning:
> arch/arm/mach-omap2/clkt_clksel.c: In function '_get_div_and_fieldval':
> arch/arm/mach-omap2/clkt_clksel.c:100:35: warning: 'max_clkr' may be
> used uninitialized in this function
>
> While at that, also add a check to avoid using max_clkr while NULL.
>
> Signed-off-by: Felipe Balbi 
> ---
>  arch/arm/mach-omap2/clkt_clksel.c |    5 -
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/clkt_clksel.c 
> b/arch/arm/mach-omap2/clkt_clksel.c
> index a781cd6..baf0b6b 100644
> --- a/arch/arm/mach-omap2/clkt_clksel.c
> +++ b/arch/arm/mach-omap2/clkt_clksel.c
> @@ -97,7 +97,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct 
> clk *clk,
>                                u32 *field_val)
>  {
>        const struct clksel *clks;
> -       const struct clksel_rate *clkr, *max_clkr;
> +       const struct clksel_rate *clkr, *max_clkr = NULL;
>        u8 max_div = 0;
>
>        clks = _get_clksel_by_parent(clk, src_clk);
> @@ -123,6 +123,9 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, 
> struct clk *clk,
>                }
>        }
>
> +       if (!max_clkr)
> +               return 0;

Would it be more appropriate to move this check after the "if" check
of max_div==0 and it's warning?
or add a warning before it returns?

> +
>        if (max_div == 0) {
>                /* This indicates an error in the clksel data */
>                WARN(1, "clock: Could not find divisor for clock %s parent %s"
> --
> 1.7.3.4.598.g85356
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/7] arm: omap2: clksel: fix compile warning

2011-01-16 Thread Felipe Balbi
Fix the following compile warning:
arch/arm/mach-omap2/clkt_clksel.c: In function '_get_div_and_fieldval':
arch/arm/mach-omap2/clkt_clksel.c:100:35: warning: 'max_clkr' may be
used uninitialized in this function

While at that, also add a check to avoid using max_clkr while NULL.

Signed-off-by: Felipe Balbi 
---
 arch/arm/mach-omap2/clkt_clksel.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/clkt_clksel.c 
b/arch/arm/mach-omap2/clkt_clksel.c
index a781cd6..baf0b6b 100644
--- a/arch/arm/mach-omap2/clkt_clksel.c
+++ b/arch/arm/mach-omap2/clkt_clksel.c
@@ -97,7 +97,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct 
clk *clk,
u32 *field_val)
 {
const struct clksel *clks;
-   const struct clksel_rate *clkr, *max_clkr;
+   const struct clksel_rate *clkr, *max_clkr = NULL;
u8 max_div = 0;
 
clks = _get_clksel_by_parent(clk, src_clk);
@@ -123,6 +123,9 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct 
clk *clk,
}
}
 
+   if (!max_clkr)
+   return 0;
+
if (max_div == 0) {
/* This indicates an error in the clksel data */
WARN(1, "clock: Could not find divisor for clock %s parent %s"
-- 
1.7.3.4.598.g85356

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html