Re: [PATCH v17 05/10] clk: Add Sunplus SP7021 clock driver

From: kernel test robot
Date: Sun Jun 12 2022 - 06:44:14 EST


Hi Qin,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pza/reset/next]
[also build test WARNING on robh/for-next clk/clk-next tip/irq/core linus/master v5.19-rc1 next-20220610]
[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/Qin-Jian/Add-Sunplus-SP7021-SoC-Support/20220607-100746
base: https://git.pengutronix.de/git/pza/linux reset/next
config: microblaze-randconfig-c024-20220612 (https://download.01.org/0day-ci/archive/20220612/202206121806.C2ECo2lB-lkp@xxxxxxxxx/config)
compiler: microblaze-linux-gcc (GCC) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>


cocci warnings: (new ones prefixed by >>)
>> drivers/clk/clk-sp7021.c:584:2-7: WARNING: invalid free of devm_ allocated data

vim +584 drivers/clk/clk-sp7021.c

550
551 static struct clk_hw *sp_pll_register(struct device *dev, const char *name,
552 const struct clk_parent_data *parent_data,
553 void __iomem *reg, int pd_bit, int bp_bit,
554 unsigned long brate, int shift, int width,
555 unsigned long flags)
556 {
557 struct sp_pll *pll;
558 struct clk_hw *hw;
559 struct clk_init_data initd = {
560 .name = name,
561 .parent_data = parent_data,
562 .ops = (bp_bit >= 0) ? &sp_pll_ops : &sp_pll_sub_ops,
563 .num_parents = 1,
564 .flags = flags,
565 };
566 int ret;
567
568 pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL);
569 if (!pll)
570 return ERR_PTR(-ENOMEM);
571
572 pll->hw.init = &initd;
573 pll->reg = reg;
574 pll->pd_bit = pd_bit;
575 pll->bp_bit = bp_bit;
576 pll->brate = brate;
577 pll->div_shift = shift;
578 pll->div_width = width;
579 spin_lock_init(&pll->lock);
580
581 hw = &pll->hw;
582 ret = devm_clk_hw_register(dev, hw);
583 if (ret) {
> 584 kfree(pll);
585 return ERR_PTR(ret);
586 }
587
588 return hw;
589 }
590

--
0-DAY CI Kernel Test Service
https://01.org/lkp