Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1628735

Re: [PATCH 1/2] clk: ti: divider: try to fix ti_clk_register_divider

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] clk: ti: divider: try to fix ti_clk_register_divider
Date 2017-04-22 04:10 +0200
Message-ID <tySEO-5dz-3@gated-at.bofh.it> (permalink)
References <ty1TP-6kT-3@gated-at.bofh.it> <tymvg-2j8-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 04/20, Tero Kristo wrote:
> On 19/04/17 20:44, Arnd Bergmann wrote:
> >The newly introduced function is entirely bogus as I found when looking
> >at this warning:
> >
> >drivers/clk/ti/divider.c: In function 'ti_clk_register_divider':
> >drivers/clk/ti/divider.c:460:8: error: 'reg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >
> >Treating a 'u32' variable as a structure leads to a stack overflow here,
> >and the register address we pass down is never initialized.
> >
> >As the code in its original form makes no sense, I can only guess what
> >the intention was, and change it to take the address from div->reg.ptr
> >instead.
> 
> Actually, I believe the code you are fixing works before this commit:
> 
> commit 6c0afb503937a12a8d20a805fcf263e31afa9871
> Author: Tero Kristo <t-kristo@ti.com>
> Date:   Thu Feb 9 11:24:37 2017 +0200
> 
>     clk: ti: convert to use proper register definition for all accesses
> 
> 
> ... it attempted to convert all the register accesses to the new
> format and change the size of the clk_omap_reg in bulk but I missed
> converting this one. Previously the size of the clk_omap_reg
> definition was u32, but this was confusing and bug prone so I
> changed it.
> 
> The failing piece of code is only executed for legacy boot mode
> OMAP3 right now, which could be potentially stripped out of the
> kernel already (I think Tony removed the support for non-DT boot
> OMAP3 boards already...?) This explains why I didn't notice the
> issue in my local testing either.
> 
> >
> >Fixes: d96f774b2538 ("clk: ti: divider: add support for legacy divider init")
> >Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> So, this patch itself is fine, but the desc should be updated to
> reflect the above somehow.
> 
> And the "Fixes:" line should be updated to point to the commit
> mentioned above also.
> 

Waiting for Arnd to agree. I can also rename reg_setup to reg.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] clk: ti: divider: try to fix ti_clk_register_divider Arnd Bergmann <arnd@arndb.de> - 2017-04-19 19:50 +0200
  Re: [PATCH 1/2] clk: ti: divider: try to fix ti_clk_register_divider Tony Lindgren <tony@atomide.com> - 2017-04-19 22:10 +0200
  Re: [PATCH 1/2] clk: ti: divider: try to fix ti_clk_register_divider Tero Kristo <t-kristo@ti.com> - 2017-04-20 17:50 +0200
    Re: [PATCH 1/2] clk: ti: divider: try to fix ti_clk_register_divider Stephen Boyd <sboyd@codeaurora.org> - 2017-04-22 04:10 +0200
      Re: [PATCH 1/2] clk: ti: divider: try to fix ti_clk_register_divider Arnd Bergmann <arnd@arndb.de> - 2017-04-22 14:10 +0200

csiph-web