CC: [email protected]
BCC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: "Chen-Yu Tsai" <[email protected]>
TO: Michael Turquette <[email protected]>
TO: Stephen Boyd <[email protected]>
CC: "Chen-Yu Tsai" <[email protected]>
CC: "Chun-Jie Chen" <[email protected]>
CC: Miles Chen <[email protected]>
CC: "Rex-BC Chen" <[email protected]>
CC: Matthias Brugger <[email protected]>
CC: AngeloGioacchino Del Regno <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

Hi Chen-Yu,

I love your patch! Perhaps something to improve:

[auto build test WARNING on clk/clk-next]
[cannot apply to v5.18-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/intel-lab-lkp/linux/commits/Chen-Yu-Tsai/clk-mediatek-Move-to-struct-clk_hw-provider-APIs/20220519-151909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
:::::: branch date: 10 hours ago
:::::: commit date: 10 hours ago
compiler: h8300-linux-gcc (GCC) 11.3.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout 791b14b4387747251f80ea0e712573fa431d655f
        cppcheck --quiet --enable=style,performance,portability --template=gcc 
FILE

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/clk/mediatek/clk-apmixed.c:99:9: warning: Returning pointer to local 
>> variable 'init' that will be invalid when returning. [returnDanglingLifetime]
    return &tx->hw;
           ^
   drivers/clk/mediatek/clk-apmixed.c:85:16: note: Address of variable taken 
here.
    tx->hw.init = &init;
                  ^
   drivers/clk/mediatek/clk-apmixed.c:94:6: note: Assuming condition is false
    if (ret) {
        ^
   drivers/clk/mediatek/clk-apmixed.c:99:9: note: Address of variable taken 
here.
    return &tx->hw;
           ^
   drivers/clk/mediatek/clk-apmixed.c:77:23: note: Variable created here.
    struct clk_init_data init = {};
                         ^
   drivers/clk/mediatek/clk-apmixed.c:99:9: note: Returning pointer to local 
variable 'init' that will be invalid when returning.
    return &tx->hw;
           ^
--
>> drivers/clk/mediatek/clk-cpumux.c:90:9: warning: Returning pointer to local 
>> variable 'init' that will be invalid when returning. [returnDanglingLifetime]
    return &cpumux->hw;
           ^
   drivers/clk/mediatek/clk-cpumux.c:82:20: note: Address of variable taken 
here.
    cpumux->hw.init = &init;
                      ^
   drivers/clk/mediatek/clk-cpumux.c:85:6: note: Assuming condition is false
    if (ret) {
        ^
   drivers/clk/mediatek/clk-cpumux.c:90:9: note: Address of variable taken here.
    return &cpumux->hw;
           ^
   drivers/clk/mediatek/clk-cpumux.c:66:23: note: Variable created here.
    struct clk_init_data init;
                         ^
   drivers/clk/mediatek/clk-cpumux.c:90:9: note: Returning pointer to local 
variable 'init' that will be invalid when returning.
    return &cpumux->hw;
           ^
--
>> drivers/clk/mediatek/clk-gate.c:190:9: warning: Returning pointer to local 
>> variable 'init' that will be invalid when returning. [returnDanglingLifetime]
    return &cg->hw;
           ^
   drivers/clk/mediatek/clk-gate.c:182:16: note: Address of variable taken here.
    cg->hw.init = &init;
                  ^
   drivers/clk/mediatek/clk-gate.c:185:6: note: Assuming condition is false
    if (ret) {
        ^
   drivers/clk/mediatek/clk-gate.c:190:9: note: Address of variable taken here.
    return &cg->hw;
           ^
   drivers/clk/mediatek/clk-gate.c:164:23: note: Variable created here.
    struct clk_init_data init = {};
                         ^
   drivers/clk/mediatek/clk-gate.c:190:9: note: Returning pointer to local 
variable 'init' that will be invalid when returning.
    return &cg->hw;
           ^

vim +/init +99 drivers/clk/mediatek/clk-apmixed.c

cdb2bab78aff97 James Liao   2015-05-20   72  
791b14b4387747 Chen-Yu Tsai 2022-05-19   73  struct clk_hw * __init 
mtk_clk_register_ref2usb_tx(const char *name,
cdb2bab78aff97 James Liao   2015-05-20   74                     const char 
*parent_name, void __iomem *reg)
cdb2bab78aff97 James Liao   2015-05-20   75  {
cdb2bab78aff97 James Liao   2015-05-20   76     struct mtk_ref2usb_tx *tx;
cdb2bab78aff97 James Liao   2015-05-20   77     struct clk_init_data init = {};
791b14b4387747 Chen-Yu Tsai 2022-05-19   78     int ret;
cdb2bab78aff97 James Liao   2015-05-20   79  
cdb2bab78aff97 James Liao   2015-05-20   80     tx = kzalloc(sizeof(*tx), 
GFP_KERNEL);
cdb2bab78aff97 James Liao   2015-05-20   81     if (!tx)
cdb2bab78aff97 James Liao   2015-05-20   82             return ERR_PTR(-ENOMEM);
cdb2bab78aff97 James Liao   2015-05-20   83  
cdb2bab78aff97 James Liao   2015-05-20   84     tx->base_addr = reg;
cdb2bab78aff97 James Liao   2015-05-20   85     tx->hw.init = &init;
cdb2bab78aff97 James Liao   2015-05-20   86  
cdb2bab78aff97 James Liao   2015-05-20   87     init.name = name;
cdb2bab78aff97 James Liao   2015-05-20   88     init.ops = &mtk_ref2usb_tx_ops;
cdb2bab78aff97 James Liao   2015-05-20   89     init.parent_names = 
&parent_name;
cdb2bab78aff97 James Liao   2015-05-20   90     init.num_parents = 1;
cdb2bab78aff97 James Liao   2015-05-20   91  
791b14b4387747 Chen-Yu Tsai 2022-05-19   92     ret = clk_hw_register(NULL, 
&tx->hw);
cdb2bab78aff97 James Liao   2015-05-20   93  
791b14b4387747 Chen-Yu Tsai 2022-05-19   94     if (ret) {
cdb2bab78aff97 James Liao   2015-05-20   95             kfree(tx);
791b14b4387747 Chen-Yu Tsai 2022-05-19   96             return ERR_PTR(ret);
791b14b4387747 Chen-Yu Tsai 2022-05-19   97     }
cdb2bab78aff97 James Liao   2015-05-20   98  
791b14b4387747 Chen-Yu Tsai 2022-05-19  @99     return &tx->hw;
cdb2bab78aff97 James Liao   2015-05-20  100  }
32b028fb1d09a0 Miles Chen   2021-09-02  101  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to