Re: [PATCH v7 2/9] mfd: qcom-spmi-pmic: expose the PMIC revid information to clients

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Caleb,

url:    https://github.com/0day-ci/linux/commits/Caleb-Connolly/iio-adc-introduce-Qualcomm-SPMI-Round-Robin-ADC/20220216-215127
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm-randconfig-m031-20220217 (https://download.01.org/0day-ci/archive/20220218/202202180412.YwXgb5WR-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/mfd/qcom-spmi-pmic.c:104 qcom_pmic_get() error: uninitialized symbol 'other_usid'.

vim +/other_usid +104 drivers/mfd/qcom-spmi-pmic.c

0e7c7a6e235e61 Caleb Connolly 2022-02-16   72  const struct qcom_spmi_pmic *qcom_pmic_get(struct device *dev)
0e7c7a6e235e61 Caleb Connolly 2022-02-16   73  {
0e7c7a6e235e61 Caleb Connolly 2022-02-16   74  	struct spmi_device *sdev;
0e7c7a6e235e61 Caleb Connolly 2022-02-16   75  	struct device_node *spmi_bus;
0e7c7a6e235e61 Caleb Connolly 2022-02-16   76  	struct device_node *other_usid;
0e7c7a6e235e61 Caleb Connolly 2022-02-16   77  	int function_parent_usid, ret;
0e7c7a6e235e61 Caleb Connolly 2022-02-16   78  	u32 reg[2];
0e7c7a6e235e61 Caleb Connolly 2022-02-16   79  
0e7c7a6e235e61 Caleb Connolly 2022-02-16   80  	if (!of_match_device(pmic_spmi_id_table, dev->parent))
0e7c7a6e235e61 Caleb Connolly 2022-02-16   81  		return ERR_PTR(-EINVAL);
0e7c7a6e235e61 Caleb Connolly 2022-02-16   82  
0e7c7a6e235e61 Caleb Connolly 2022-02-16   83  	sdev = to_spmi_device(dev->parent);
0e7c7a6e235e61 Caleb Connolly 2022-02-16   84  	if (!sdev)
0e7c7a6e235e61 Caleb Connolly 2022-02-16   85  		return ERR_PTR(-EINVAL);
0e7c7a6e235e61 Caleb Connolly 2022-02-16   86  
0e7c7a6e235e61 Caleb Connolly 2022-02-16   87  	/*
0e7c7a6e235e61 Caleb Connolly 2022-02-16   88  	 * Quick return if the function device is already in the right
0e7c7a6e235e61 Caleb Connolly 2022-02-16   89  	 * USID
0e7c7a6e235e61 Caleb Connolly 2022-02-16   90  	 */
0e7c7a6e235e61 Caleb Connolly 2022-02-16   91  	if (sdev->usid % 2 == 0)
0e7c7a6e235e61 Caleb Connolly 2022-02-16   92  		return spmi_device_get_drvdata(sdev);
0e7c7a6e235e61 Caleb Connolly 2022-02-16   93  
0e7c7a6e235e61 Caleb Connolly 2022-02-16   94  	function_parent_usid = sdev->usid;
0e7c7a6e235e61 Caleb Connolly 2022-02-16   95  
0e7c7a6e235e61 Caleb Connolly 2022-02-16   96  	/*
0e7c7a6e235e61 Caleb Connolly 2022-02-16   97  	 * Walk through the list of PMICs until we find the sibling USID.
0e7c7a6e235e61 Caleb Connolly 2022-02-16   98  	 * The goal is the find to previous sibling. Assuming there is no
0e7c7a6e235e61 Caleb Connolly 2022-02-16   99  	 * PMIC with more than 2 USIDs. We know that function_parent_usid
0e7c7a6e235e61 Caleb Connolly 2022-02-16  100  	 * is one greater than the base USID.
0e7c7a6e235e61 Caleb Connolly 2022-02-16  101  	 */
0e7c7a6e235e61 Caleb Connolly 2022-02-16  102  	spmi_bus = of_get_parent(sdev->dev.parent->of_node);
0e7c7a6e235e61 Caleb Connolly 2022-02-16  103  	do {
0e7c7a6e235e61 Caleb Connolly 2022-02-16 @104  		other_usid = of_get_next_child(spmi_bus, other_usid);
                                                                                                 ^^^^^^^^^^
Uninitialized.

0e7c7a6e235e61 Caleb Connolly 2022-02-16  105  		ret = of_property_read_u32_array(other_usid, "reg", reg, 2);
0e7c7a6e235e61 Caleb Connolly 2022-02-16  106  		if (ret)
0e7c7a6e235e61 Caleb Connolly 2022-02-16  107  			return ERR_PTR(ret);
0e7c7a6e235e61 Caleb Connolly 2022-02-16  108  		sdev = spmi_device_from_of(other_usid);
0e7c7a6e235e61 Caleb Connolly 2022-02-16  109  		if (sdev == NULL) {
0e7c7a6e235e61 Caleb Connolly 2022-02-16  110  			/*
0e7c7a6e235e61 Caleb Connolly 2022-02-16  111  			 * If the base USID for this PMIC hasn't probed yet
0e7c7a6e235e61 Caleb Connolly 2022-02-16  112  			 * but the secondary USID has, then we need to defer
0e7c7a6e235e61 Caleb Connolly 2022-02-16  113  			 * the function driver so that it will attempt to
0e7c7a6e235e61 Caleb Connolly 2022-02-16  114  			 * probe again when the base USID is ready.
0e7c7a6e235e61 Caleb Connolly 2022-02-16  115  			 */
0e7c7a6e235e61 Caleb Connolly 2022-02-16  116  			if (reg[0] == function_parent_usid - 1)
0e7c7a6e235e61 Caleb Connolly 2022-02-16  117  				return ERR_PTR(-EPROBE_DEFER);
0e7c7a6e235e61 Caleb Connolly 2022-02-16  118  
0e7c7a6e235e61 Caleb Connolly 2022-02-16  119  			continue;
0e7c7a6e235e61 Caleb Connolly 2022-02-16  120  		}
0e7c7a6e235e61 Caleb Connolly 2022-02-16  121  
0e7c7a6e235e61 Caleb Connolly 2022-02-16  122  		if (reg[0] == function_parent_usid - 1)
0e7c7a6e235e61 Caleb Connolly 2022-02-16  123  			return spmi_device_get_drvdata(sdev);
0e7c7a6e235e61 Caleb Connolly 2022-02-16  124  	} while (other_usid->sibling);
0e7c7a6e235e61 Caleb Connolly 2022-02-16  125  
0e7c7a6e235e61 Caleb Connolly 2022-02-16  126  	return ERR_PTR(-ENODATA);
0e7c7a6e235e61 Caleb Connolly 2022-02-16  127  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux