Re: drivers/spmi/spmi-pmic-arb.c:1782 spmi_pmic_arb_register_buses() error: uninitialized symbol 'ret'.
From: Stephen Boyd
Date: Wed Oct 09 2024 - 18:59:03 EST
Quoting Dan Carpenter (2024-09-18 03:29:07)
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: adfc3ded5c33d67e822525f95404ef0becb099b8
> commit: 9799873717398e8fa1727482e578b9d777da645e spmi: pmic-arb: Add multi bus support
> config: mips-randconfig-r072-20240916 (https://download.01.org/0day-ci/archive/20240916/202409162313.TnpH4qKB-lkp@xxxxxxxxx/config)
> compiler: mips64-linux-gcc (GCC) 14.1.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/202409162313.TnpH4qKB-lkp@xxxxxxxxx/
>
> smatch warnings:
> drivers/spmi/spmi-pmic-arb.c:1782 spmi_pmic_arb_register_buses() error: uninitialized symbol 'ret'.
>
> vim +/ret +1782 drivers/spmi/spmi-pmic-arb.c
>
> 9799873717398e8 Abel Vesa 2024-05-07 1762 static int spmi_pmic_arb_register_buses(struct spmi_pmic_arb *pmic_arb,
> 9799873717398e8 Abel Vesa 2024-05-07 1763 struct platform_device *pdev)
> 9799873717398e8 Abel Vesa 2024-05-07 1764 {
> 9799873717398e8 Abel Vesa 2024-05-07 1765 struct device *dev = &pdev->dev;
> 9799873717398e8 Abel Vesa 2024-05-07 1766 struct device_node *node = dev->of_node;
> 9799873717398e8 Abel Vesa 2024-05-07 1767 struct device_node *child;
> 9799873717398e8 Abel Vesa 2024-05-07 1768 int ret;
> 9799873717398e8 Abel Vesa 2024-05-07 1769
> 9799873717398e8 Abel Vesa 2024-05-07 1770 /* legacy mode doesn't provide child node for the bus */
> 9799873717398e8 Abel Vesa 2024-05-07 1771 if (of_device_is_compatible(node, "qcom,spmi-pmic-arb"))
> 9799873717398e8 Abel Vesa 2024-05-07 1772 return spmi_pmic_arb_bus_init(pdev, node, pmic_arb);
> 9799873717398e8 Abel Vesa 2024-05-07 1773
> 9799873717398e8 Abel Vesa 2024-05-07 1774 for_each_available_child_of_node(node, child) {
> 9799873717398e8 Abel Vesa 2024-05-07 1775 if (of_node_name_eq(child, "spmi")) {
> 9799873717398e8 Abel Vesa 2024-05-07 1776 ret = spmi_pmic_arb_bus_init(pdev, child, pmic_arb);
> 9799873717398e8 Abel Vesa 2024-05-07 1777 if (ret)
> 9799873717398e8 Abel Vesa 2024-05-07 1778 return ret;
> 9799873717398e8 Abel Vesa 2024-05-07 1779 }
> 9799873717398e8 Abel Vesa 2024-05-07 1780 }
> 9799873717398e8 Abel Vesa 2024-05-07 1781
> 9799873717398e8 Abel Vesa 2024-05-07 @1782 return ret;
>
> Is it possible to not have an spmi node?
I'm amendable to a 'return 0' here.