linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/7] arm: omap2: clksel: fix compile warning
Date: Wed, 19 Jan 2011 15:09:39 -0800	[thread overview]
Message-ID: <20110119230939.GL4957@atomide.com> (raw)
In-Reply-To: <20110117081845.GF2812@legolas.emea.dhcp.ti.com>

* Felipe Balbi <balbi@ti.com> [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 <balbi@ti.com> 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 <balbi@ti.com>
> > > ---
> > > ?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

  reply	other threads:[~2011-01-19 23:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-17  4:31 [PATCH 0/7] OMAP compile warning fix Felipe Balbi
2011-01-17  4:31 ` [PATCH 1/7] arm: omap: i2c: fix compile warning Felipe Balbi
2011-01-17  4:31 ` [PATCH 2/7] arm: omap1: " Felipe Balbi
2011-01-17  4:31 ` [PATCH 3/7] arm: omap1: fix compile warnings Felipe Balbi
2011-01-17  4:31 ` [PATCH 4/7] arm: omap1: fix a bunch of section mismatches Felipe Balbi
2011-01-17  4:31 ` [PATCH 5/7] arm: omap2: mux: fix compile warning Felipe Balbi
2011-01-17  4:31 ` [PATCH 6/7] arm: omap2: irq: fix compile warning: Felipe Balbi
2011-01-17  4:31 ` [PATCH 7/7] arm: omap2: clksel: fix compile warning Felipe Balbi
2011-01-17  8:07   ` Varadarajan, Charulatha
2011-01-17  8:18     ` Felipe Balbi
2011-01-19 23:09       ` Tony Lindgren [this message]
2011-01-20  1:25 ` [PATCH 0/7] OMAP compile warning fix Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110119230939.GL4957@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).