Re: [PATCH v3 3/3] clk: spacemit: Add clock support for Spacemit K1 SoC

From: Dan Carpenter
Date: Mon Dec 09 2024 - 01:52:05 EST


Hi Haylen,

kernel test robot noticed the following build warnings:

url: https://github.com/intel-lab-lkp/linux/commits/Haylen-Chu/dt-bindings-clock-spacemit-Add-clock-controllers-of-Spacemit-K1-SoC/20241128-101248
base: 2d5404caa8c7bb5c4e0435f94b28834ae5456623
patch link: https://lore.kernel.org/r/20241126143125.9980-7-heylenay%404d2.org
patch subject: [PATCH v3 3/3] clk: spacemit: Add clock support for Spacemit K1 SoC
config: arm64-randconfig-r073-20241207 (https://download.01.org/0day-ci/archive/20241207/202412072123.ne7GnRyJ-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 14.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202412072123.ne7GnRyJ-lkp@xxxxxxxxx/

smatch warnings:
drivers/clk/spacemit/ccu-k1.c:1686 k1_ccu_probe() error: uninitialized symbol 'lock_map'.

vim +/lock_map +1686 drivers/clk/spacemit/ccu-k1.c

e71e4621b06cd42 Haylen Chu 2024-11-26 1651 static int k1_ccu_probe(struct platform_device *pdev)
e71e4621b06cd42 Haylen Chu 2024-11-26 1652 {
e71e4621b06cd42 Haylen Chu 2024-11-26 1653 const struct spacemit_ccu_data *data;
e71e4621b06cd42 Haylen Chu 2024-11-26 1654 struct regmap *base_map, *lock_map;
e71e4621b06cd42 Haylen Chu 2024-11-26 1655 struct device *dev = &pdev->dev;
e71e4621b06cd42 Haylen Chu 2024-11-26 1656 struct spacemit_ccu_priv *priv;
e71e4621b06cd42 Haylen Chu 2024-11-26 1657 struct device_node *parent;
e71e4621b06cd42 Haylen Chu 2024-11-26 1658 int ret;
e71e4621b06cd42 Haylen Chu 2024-11-26 1659
e71e4621b06cd42 Haylen Chu 2024-11-26 1660 data = of_device_get_match_data(dev);
e71e4621b06cd42 Haylen Chu 2024-11-26 1661 if (WARN_ON(!data))
e71e4621b06cd42 Haylen Chu 2024-11-26 1662 return -EINVAL;
e71e4621b06cd42 Haylen Chu 2024-11-26 1663
e71e4621b06cd42 Haylen Chu 2024-11-26 1664 parent = of_get_parent(dev->of_node);
e71e4621b06cd42 Haylen Chu 2024-11-26 1665 base_map = syscon_node_to_regmap(parent);
e71e4621b06cd42 Haylen Chu 2024-11-26 1666 of_node_put(parent);
e71e4621b06cd42 Haylen Chu 2024-11-26 1667
e71e4621b06cd42 Haylen Chu 2024-11-26 1668 if (IS_ERR(base_map))
e71e4621b06cd42 Haylen Chu 2024-11-26 1669 return dev_err_probe(dev, PTR_ERR(base_map),
e71e4621b06cd42 Haylen Chu 2024-11-26 1670 "failed to get regmap\n");
e71e4621b06cd42 Haylen Chu 2024-11-26 1671
e71e4621b06cd42 Haylen Chu 2024-11-26 1672 if (data->need_pll_lock) {
e71e4621b06cd42 Haylen Chu 2024-11-26 1673 lock_map = syscon_regmap_lookup_by_phandle(dev->of_node,
e71e4621b06cd42 Haylen Chu 2024-11-26 1674 "spacemit,mpmu");
e71e4621b06cd42 Haylen Chu 2024-11-26 1675 if (IS_ERR(lock_map))
e71e4621b06cd42 Haylen Chu 2024-11-26 1676 return dev_err_probe(dev, PTR_ERR(lock_map),
e71e4621b06cd42 Haylen Chu 2024-11-26 1677 "failed to get lock regmap\n");
e71e4621b06cd42 Haylen Chu 2024-11-26 1678 }

lock_map not initialized on else path.

e71e4621b06cd42 Haylen Chu 2024-11-26 1679
e71e4621b06cd42 Haylen Chu 2024-11-26 1680 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
e71e4621b06cd42 Haylen Chu 2024-11-26 1681 if (!priv)
e71e4621b06cd42 Haylen Chu 2024-11-26 1682 return -ENOMEM;
e71e4621b06cd42 Haylen Chu 2024-11-26 1683
e71e4621b06cd42 Haylen Chu 2024-11-26 1684 priv->data = data;
e71e4621b06cd42 Haylen Chu 2024-11-26 1685 priv->base = base_map;
e71e4621b06cd42 Haylen Chu 2024-11-26 @1686 priv->lock_base = lock_map;
^^^^^^^^^

e71e4621b06cd42 Haylen Chu 2024-11-26 1687
e71e4621b06cd42 Haylen Chu 2024-11-26 1688 ret = spacemit_ccu_register(dev, priv);
e71e4621b06cd42 Haylen Chu 2024-11-26 1689 if (ret)
e71e4621b06cd42 Haylen Chu 2024-11-26 1690 return dev_err_probe(dev, ret, "failed to register clocks\n");
e71e4621b06cd42 Haylen Chu 2024-11-26 1691
e71e4621b06cd42 Haylen Chu 2024-11-26 1692 return 0;
e71e4621b06cd42 Haylen Chu 2024-11-26 1693 }

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki