devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Caleb Connolly <caleb.connolly@linaro.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>, Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Lee Jones <lee.jones@linaro.org>, Stephen Boyd <sboyd@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Cc: lkp@intel.com, kbuild-all@lists.01.org, sumit.semwal@linaro.org,
	amit.pundir@linaro.org, john.stultz@linaro.org
Subject: Re: [PATCH v7 2/9] mfd: qcom-spmi-pmic: expose the PMIC revid information to clients
Date: Fri, 18 Feb 2022 14:38:12 +0300	[thread overview]
Message-ID: <202202180412.YwXgb5WR-lkp@intel.com> (raw)
In-Reply-To: <20220216134920.239989-3-caleb.connolly@linaro.org>

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@intel.com/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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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@lists.01.org


  reply	other threads:[~2022-02-18 11:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 13:49 [PATCH v7 0/9] iio: adc: introduce Qualcomm SPMI Round Robin ADC Caleb Connolly
2022-02-16 13:49 ` [PATCH v7 1/9] spmi: add a helper to look up an SPMI device from a device node Caleb Connolly
2022-02-19 18:19   ` Jonathan Cameron
2022-02-16 13:49 ` [PATCH v7 2/9] mfd: qcom-spmi-pmic: expose the PMIC revid information to clients Caleb Connolly
2022-02-18 11:38   ` Dan Carpenter [this message]
2022-02-19 18:27   ` Jonathan Cameron
2022-02-21 17:19     ` Caleb Connolly
2022-02-26 16:47       ` Jonathan Cameron
2022-02-16 13:49 ` [PATCH v7 3/9] mfd: qcom-spmi-pmic: read fab id on supported PMICs Caleb Connolly
2022-02-16 13:49 ` [PATCH v7 4/9] dt-bindings: iio: adc: document qcom-spmi-rradc Caleb Connolly
2022-02-16 13:49 ` [PATCH v7 5/9] iio: adc: qcom-spmi-rradc: introduce round robin adc Caleb Connolly
2022-02-19 18:44   ` Jonathan Cameron
2022-02-16 13:49 ` [PATCH v7 6/9] arm64: dts: qcom: pmi8998: add rradc node Caleb Connolly
2022-02-16 13:49 ` [PATCH v7 7/9] arm64: dts: qcom: sdm845-oneplus: enable rradc Caleb Connolly
2022-02-16 13:49 ` [PATCH v7 8/9] arm64: dts: qcom: sdm845-db845c: " Caleb Connolly
2022-02-16 13:49 ` [PATCH v7 9/9] arm64: dts: qcom: sdm845-xiaomi-beryllium: " Caleb Connolly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202202180412.YwXgb5WR-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=agross@kernel.org \
    --cc=amit.pundir@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=caleb.connolly@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=john.stultz@linaro.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).