All of lore.kernel.org
 help / color / mirror / Atom feed
* [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'
@ 2026-07-09 10:37 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-07-03  7:51 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [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'
@ 2026-07-09 10:37 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2026-07-09 10:37 UTC (permalink / raw)
  To: oe-kbuild, Thomas Weißschuh; +Cc: lkp, oe-kbuild-all

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-09 10:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-03  7:51 [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' kernel test robot
2026-07-09 10:37 ` Dan Carpenter

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.