All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH 2/5] power: supply: core: add function to get supplies from fwnode
Date: Mon, 17 Mar 2025 03:34:29 +0800	[thread overview]
Message-ID: <202503170343.AW93SIMu-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250312-batt_ops-v1-2-88e0bb3129fd@google.com>
References: <20250312-batt_ops-v1-2-88e0bb3129fd@google.com>
TO: Amit Sunil Dhamne via B4 Relay <devnull+amitsd.google.com@kernel.org>
TO: Rob Herring <robh@kernel.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>
TO: Conor Dooley <conor+dt@kernel.org>
TO: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
TO: Badhri Jagan Sridharan <badhri@google.com>
TO: Sebastian Reichel <sre@kernel.org>
TO: Heikki Krogerus <heikki.krogerus@linux.intel.com>
TO: "Rafael J. Wysocki" <rafael@kernel.org>
TO: Len Brown <len.brown@intel.com>
TO: Pavel Machek <pavel@kernel.org>
CC: devicetree@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: linux-pm@vger.kernel.org
CC: RD Babiera <rdbabiera@google.com>
CC: Kyle Tso <kyletso@google.com>
CC: Amit Sunil Dhamne <amitsd@google.com>

Hi Amit,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 80e54e84911a923c40d7bee33a34c1b4be148d7a]

url:    https://github.com/intel-lab-lkp/linux/commits/Amit-Sunil-Dhamne-via-B4-Relay/dt-bindings-connector-add-fixed-batteries-property/20250313-074635
base:   80e54e84911a923c40d7bee33a34c1b4be148d7a
patch link:    https://lore.kernel.org/r/20250312-batt_ops-v1-2-88e0bb3129fd%40google.com
patch subject: [PATCH 2/5] power: supply: core: add function to get supplies from fwnode
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: riscv-randconfig-r073-20250316 (https://download.01.org/0day-ci/archive/20250317/202503170343.AW93SIMu-lkp@intel.com/config)
compiler: riscv64-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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202503170343.AW93SIMu-lkp@intel.com/

smatch warnings:
drivers/power/supply/power_supply_core.c:649 power_supply_get_by_fwnode_reference_array() error: uninitialized symbol 'ret'.

vim +/ret +649 drivers/power/supply/power_supply_core.c

0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  600  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  601  /**
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  602   * power_supply_get_by_fwnode_reference_array() - Returns an array of power
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  603   * supply objects associated with each fwnode reference present in the property
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  604   * @fwnode: Pointer to fwnode to lookup property
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  605   * @property: Name of property holding references
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  606   * @psy: Resulting array of power_supply pointers. To be provided by the caller.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  607   * @size: size of power_supply pointer array.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  608   *
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  609   * If power supply was found, it increases reference count for the
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  610   * internal power supply's device. The user should power_supply_put()
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  611   * after usage.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  612   *
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  613   * Return: On success returns the number of power supply objects filled
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  614   * in the @psy array.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  615   * -EOVERFLOW when size of @psy array is not suffice.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  616   * -EINVAL when @psy is NULL or @size is 0.
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  617   * -ENODATA when fwnode does not contain the given property
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  618   */
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  619  int power_supply_get_by_fwnode_reference_array(struct fwnode_handle *fwnode,
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  620  					       const char *property,
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  621  					       struct power_supply **psy,
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  622  					       ssize_t size)
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  623  {
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  624  	int ret, index, count = 0;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  625  	struct fwnode_reference_args args;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  626  	struct device *dev;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  627  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  628  	if (!psy || !size)
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  629  		return -EINVAL;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  630  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  631  	for (index = 0; index < size &&
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  632  	     !(ret = fwnode_property_get_reference_args(fwnode, property, NULL,
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  633  							0, index, &args));
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  634  	     ++index) {
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  635  		dev = class_find_device(&power_supply_class, NULL, args.fwnode,
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  636  					power_supply_match_fwnode);
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  637  		fwnode_handle_put(args.fwnode);
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  638  		if (!dev)
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  639  			continue;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  640  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  641  		if (count > size)
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  642  			return -EOVERFLOW;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  643  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  644  		psy[count] = dev_get_drvdata(dev);
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  645  		atomic_inc(&psy[count]->use_cnt);
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  646  		++count;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  647  	}
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  648  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12 @649  	if (ret != -ENOENT)
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  650  		return ret;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  651  
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  652  	return index ? count : -ENODATA;
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  653  }
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  654  EXPORT_SYMBOL_GPL(power_supply_get_by_fwnode_reference_array);
0c8087f6d68b4cd Amit Sunil Dhamne 2025-03-12  655  

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

             reply	other threads:[~2025-03-16 19:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-16 19:34 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-12 23:42 [PATCH 0/5] Add support for Battery Status & Battery Caps AMS in TCPM Amit Sunil Dhamne
2025-03-12 23:42 ` [PATCH 2/5] power: supply: core: add function to get supplies from fwnode Amit Sunil Dhamne
2025-03-12 23:42   ` Amit Sunil Dhamne via B4 Relay
2025-03-19 13:54   ` Heikki Krogerus
2025-04-08 19:54     ` Amit Sunil Dhamne

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=202503170343.AW93SIMu-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.