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: [thomas-weissschuh:b4/cros_ec-hwmon-locking 2/6] drivers/hwmon/cros_ec_hwmon.c:578 cros_ec_hwmon_probe() warn: passing zero to 'PTR_ERR'
Date: Fri, 03 Jul 2026 15:51:29 +0800	[thread overview]
Message-ID: <202607031558.090AWNd1-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: "Thomas Weißschuh" <linux@weissschuh.net>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/thomas.weissschuh/linux.git b4/cros_ec-hwmon-locking
head:   95003896306434c5e2d6cae819f38179e0f5048f
commit: d54d63ebb10e19d82a484c16372173926c021022 [2/6] priv
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: sparc-randconfig-r071-20260702 (https://download.01.org/0day-ci/archive/20260703/202607031558.090AWNd1-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 13.4.0
smatch: v0.5.0-9185-gbcc58b9c

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/202607031558.090AWNd1-lkp@intel.com/

smatch warnings:
drivers/hwmon/cros_ec_hwmon.c:578 cros_ec_hwmon_probe() warn: passing zero to 'PTR_ERR'

vim +/PTR_ERR +578 drivers/hwmon/cros_ec_hwmon.c

5798b62867b47b Sung-Chi Li      2025-09-11  545  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  546  static int cros_ec_hwmon_probe(struct platform_device *pdev)
bc3e45258096f2 Thomas Weißschuh 2024-05-29  547  {
bc3e45258096f2 Thomas Weißschuh 2024-05-29  548  	struct device *dev = &pdev->dev;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  549  	struct cros_ec_dev *ec_dev = dev_get_drvdata(dev->parent);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  550  	struct cros_ec_device *cros_ec = ec_dev->ec_dev;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  551  	struct cros_ec_hwmon_priv *priv;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  552  	struct device *hwmon_dev;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  553  	u8 thermal_version;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  554  	int ret;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  555  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  556  	ret = cros_ec_cmd_readmem(cros_ec, EC_MEMMAP_THERMAL_VERSION, 1, &thermal_version);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  557  	if (ret < 0)
bc3e45258096f2 Thomas Weißschuh 2024-05-29  558  		return ret;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  559  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  560  	/* Covers both fan and temp sensors */
bc3e45258096f2 Thomas Weißschuh 2024-05-29  561  	if (thermal_version == 0)
bc3e45258096f2 Thomas Weißschuh 2024-05-29  562  		return -ENODEV;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  563  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  564  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  565  	if (!priv)
bc3e45258096f2 Thomas Weißschuh 2024-05-29  566  		return -ENOMEM;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  567  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  568  	priv->cros_ec = cros_ec;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  569  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  570  	cros_ec_hwmon_probe_temp_sensors(dev, priv, thermal_version);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  571  	cros_ec_hwmon_probe_fans(priv);
fb8e659309f72e Sung-Chi Li      2025-09-11  572  	priv->fan_control_supported = cros_ec_hwmon_probe_fan_control_supported(priv->cros_ec);
afa7c56ec44731 Thomas Weißschuh 2026-01-18  573  	priv->temp_threshold_supported = is_cros_ec_cmd_available(priv->cros_ec,
afa7c56ec44731 Thomas Weißschuh 2026-01-18  574  								  EC_CMD_THERMAL_GET_THRESHOLD, 1);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  575  
d54d63ebb10e19 Thomas Weißschuh 2026-07-01  576  	priv->hwmon_dev = devm_hwmon_device_register_with_info(dev, "cros_ec", priv,
bc3e45258096f2 Thomas Weißschuh 2024-05-29  577  							       &cros_ec_hwmon_chip_info, NULL);
d54d63ebb10e19 Thomas Weißschuh 2026-07-01 @578  	if (PTR_ERR(priv->hwmon_dev))
d54d63ebb10e19 Thomas Weißschuh 2026-07-01  579  		return PTR_ERR(priv->hwmon_dev);
d54d63ebb10e19 Thomas Weißschuh 2026-07-01  580  
d54d63ebb10e19 Thomas Weißschuh 2026-07-01  581  	cros_ec_hwmon_register_fan_cooling_devices(dev, priv);
d54d63ebb10e19 Thomas Weißschuh 2026-07-01  582  
fb8e659309f72e Sung-Chi Li      2025-09-11  583  	platform_set_drvdata(pdev, priv);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  584  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  585  	return PTR_ERR_OR_ZERO(hwmon_dev);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  586  }
bc3e45258096f2 Thomas Weißschuh 2024-05-29  587  

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev, "Thomas Weißschuh" <linux@weissschuh.net>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev
Subject: [thomas-weissschuh:b4/cros_ec-hwmon-locking 2/6] drivers/hwmon/cros_ec_hwmon.c:578 cros_ec_hwmon_probe() warn: passing zero to 'PTR_ERR'
Date: Thu, 9 Jul 2026 13:37:14 +0300	[thread overview]
Message-ID: <202607031558.090AWNd1-lkp@intel.com> (raw)
Message-ID: <20260709103714.VgCV9Zd3JTMXRriEwzwmi7nnuPH7nIgrSvm-t7wJqvE@z> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/thomas.weissschuh/linux.git b4/cros_ec-hwmon-locking
head:   95003896306434c5e2d6cae819f38179e0f5048f
commit: d54d63ebb10e19d82a484c16372173926c021022 [2/6] priv
config: sparc-randconfig-r071-20260702 (https://download.01.org/0day-ci/archive/20260703/202607031558.090AWNd1-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 13.4.0
smatch: v0.5.0-9185-gbcc58b9c

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/202607031558.090AWNd1-lkp@intel.com/

smatch warnings:
drivers/hwmon/cros_ec_hwmon.c:578 cros_ec_hwmon_probe() warn: passing zero to 'PTR_ERR'

vim +/PTR_ERR +578 drivers/hwmon/cros_ec_hwmon.c

bc3e45258096f2 Thomas Weißschuh 2024-05-29  546  static int cros_ec_hwmon_probe(struct platform_device *pdev)
bc3e45258096f2 Thomas Weißschuh 2024-05-29  547  {
bc3e45258096f2 Thomas Weißschuh 2024-05-29  548  	struct device *dev = &pdev->dev;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  549  	struct cros_ec_dev *ec_dev = dev_get_drvdata(dev->parent);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  550  	struct cros_ec_device *cros_ec = ec_dev->ec_dev;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  551  	struct cros_ec_hwmon_priv *priv;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  552  	struct device *hwmon_dev;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  553  	u8 thermal_version;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  554  	int ret;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  555  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  556  	ret = cros_ec_cmd_readmem(cros_ec, EC_MEMMAP_THERMAL_VERSION, 1, &thermal_version);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  557  	if (ret < 0)
bc3e45258096f2 Thomas Weißschuh 2024-05-29  558  		return ret;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  559  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  560  	/* Covers both fan and temp sensors */
bc3e45258096f2 Thomas Weißschuh 2024-05-29  561  	if (thermal_version == 0)
bc3e45258096f2 Thomas Weißschuh 2024-05-29  562  		return -ENODEV;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  563  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  564  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  565  	if (!priv)
bc3e45258096f2 Thomas Weißschuh 2024-05-29  566  		return -ENOMEM;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  567  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  568  	priv->cros_ec = cros_ec;
bc3e45258096f2 Thomas Weißschuh 2024-05-29  569  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  570  	cros_ec_hwmon_probe_temp_sensors(dev, priv, thermal_version);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  571  	cros_ec_hwmon_probe_fans(priv);
fb8e659309f72e Sung-Chi Li      2025-09-11  572  	priv->fan_control_supported = cros_ec_hwmon_probe_fan_control_supported(priv->cros_ec);
afa7c56ec44731 Thomas Weißschuh 2026-01-18  573  	priv->temp_threshold_supported = is_cros_ec_cmd_available(priv->cros_ec,
afa7c56ec44731 Thomas Weißschuh 2026-01-18  574  								  EC_CMD_THERMAL_GET_THRESHOLD, 1);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  575  
d54d63ebb10e19 Thomas Weißschuh 2026-07-01  576  	priv->hwmon_dev = devm_hwmon_device_register_with_info(dev, "cros_ec", priv,
bc3e45258096f2 Thomas Weißschuh 2024-05-29  577  							       &cros_ec_hwmon_chip_info, NULL);
d54d63ebb10e19 Thomas Weißschuh 2026-07-01 @578  	if (PTR_ERR(priv->hwmon_dev))

s/PTR_ERR/IS_ERR/

d54d63ebb10e19 Thomas Weißschuh 2026-07-01  579  		return PTR_ERR(priv->hwmon_dev);
d54d63ebb10e19 Thomas Weißschuh 2026-07-01  580  
d54d63ebb10e19 Thomas Weißschuh 2026-07-01  581  	cros_ec_hwmon_register_fan_cooling_devices(dev, priv);
d54d63ebb10e19 Thomas Weißschuh 2026-07-01  582  
fb8e659309f72e Sung-Chi Li      2025-09-11  583  	platform_set_drvdata(pdev, priv);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  584  
bc3e45258096f2 Thomas Weißschuh 2024-05-29  585  	return PTR_ERR_OR_ZERO(hwmon_dev);
bc3e45258096f2 Thomas Weißschuh 2024-05-29  586  }

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


             reply	other threads:[~2026-07-03  7:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03  7:51 kernel test robot [this message]
2026-07-09 10:37 ` [thomas-weissschuh:b4/cros_ec-hwmon-locking 2/6] drivers/hwmon/cros_ec_hwmon.c:578 cros_ec_hwmon_probe() warn: passing zero to 'PTR_ERR' Dan Carpenter

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=202607031558.090AWNd1-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.