public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Naresh Solanki <naresh.solanki@9elements.com>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>
Cc: oe-kbuild-all@lists.linux.dev,
	Naresh Solanki <naresh.solanki@9elements.com>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] hwmon: (max6639) : Update hwmon init using info structure
Date: Tue, 4 Jun 2024 08:47:26 +0800	[thread overview]
Message-ID: <202406040851.agdur2M1-lkp@intel.com> (raw)
In-Reply-To: <20240603103114.3263060-1-naresh.solanki@9elements.com>

Hi Naresh,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 5fbf8734fb36cf67339f599f0e51747a6aff690c]

url:    https://github.com/intel-lab-lkp/linux/commits/Naresh-Solanki/hwmon-max6639-Add-hwmon-attributes-for-fan-and-pwm/20240603-185014
base:   5fbf8734fb36cf67339f599f0e51747a6aff690c
patch link:    https://lore.kernel.org/r/20240603103114.3263060-1-naresh.solanki%409elements.com
patch subject: [PATCH v3 1/2] hwmon: (max6639) : Update hwmon init using info structure
config: i386-randconfig-141-20240604 (https://download.01.org/0day-ci/archive/20240604/202406040851.agdur2M1-lkp@intel.com/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406040851.agdur2M1-lkp@intel.com/

New smatch warnings:
drivers/hwmon/max6639.c:227 max6639_read_fan() warn: unsigned 'res' is never less than zero.
drivers/hwmon/max6639.c:235 max6639_read_fan() error: uninitialized symbol 'val'.
drivers/hwmon/max6639.c:253 max6639_fan_is_visible() warn: signedness bug returning '(-4095)'
drivers/hwmon/max6639.c:278 max6639_read_pwm() warn: unsigned 'res' is never less than zero.

Old smatch warnings:
drivers/hwmon/max6639.c:233 max6639_read_fan() warn: unsigned 'res' is never less than zero.

vim +/res +227 drivers/hwmon/max6639.c

   214	
   215	static int max6639_read_fan(struct device *dev, u32 attr, int channel,
   216				    long *fan_val)
   217	{
   218		struct max6639_data *data = dev_get_drvdata(dev);
   219		unsigned int val, res;
   220	
   221		if (IS_ERR(data))
   222			return PTR_ERR(data);
   223	
   224		switch (attr) {
   225		case hwmon_fan_input:
   226			res = regmap_read(data->regmap, MAX6639_REG_FAN_CNT(channel), &val);
 > 227			if (res < 0)
   228				return res;
   229			*fan_val = FAN_FROM_REG(val, data->rpm_range[channel]);
   230			return 0;
   231		case hwmon_fan_fault:
   232			res = max6639_get_status(dev, &val);
   233			if (res < 0)
   234				return res;
 > 235			*fan_val = !!(val & BIT(1 - channel));
   236			return 0;
   237		default:
   238			return -EOPNOTSUPP;
   239		}
   240	}
   241	
   242	static int max6639_set_ppr(struct max6639_data *data, int channel, u8 ppr)
   243	{
   244		/* Decrement the PPR value and shift left by 6 to match the register format */
   245		return regmap_write(data->regmap, MAX6639_REG_FAN_PPR(channel), ppr-- << 6);
   246	}
   247	
   248	static umode_t max6639_fan_is_visible(const void *_data, u32 attr, int channel)
   249	{
   250		struct max6639_data *data = (struct max6639_data *)_data;
   251	
   252		if (IS_ERR(data))
 > 253			return PTR_ERR(data);
   254	
   255		switch (attr) {
   256		case hwmon_fan_input:
   257		case hwmon_fan_fault:
   258			return 0444;
   259		case hwmon_fan_pulses:
   260			return 0644;
   261		default:
   262			return 0;
   263		}
   264	}
   265	
   266	static int max6639_read_pwm(struct device *dev, u32 attr, int channel,
   267				    long *pwm_val)
   268	{
   269		struct max6639_data *data = dev_get_drvdata(dev);
   270		unsigned int val, res;
   271	
   272		if (IS_ERR(data))
   273			return PTR_ERR(data);
   274	
   275		switch (attr) {
   276		case hwmon_pwm_input:
   277			res = regmap_read(data->regmap, MAX6639_REG_TARGTDUTY(channel), &val);
 > 278			if (res < 0)
   279				return res;
   280			*pwm_val = val * 255 / 120;
   281			return 0;
   282		default:
   283			return -EOPNOTSUPP;
   284		}
   285	}
   286	

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

      parent reply	other threads:[~2024-06-04  0:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-03 10:31 [PATCH v3 1/2] hwmon: (max6639) : Update hwmon init using info structure Naresh Solanki
2024-06-03 10:31 ` [PATCH v3 2/2] hwmon: (max6639) : Add hwmon attributes for fan and pwm Naresh Solanki
2024-06-03 15:01 ` [PATCH v3 1/2] hwmon: (max6639) : Update hwmon init using info structure Guenter Roeck
2024-06-04  0:47 ` kernel test robot [this message]

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=202406040851.agdur2M1-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=naresh.solanki@9elements.com \
    --cc=oe-kbuild-all@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox