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, Julia Lawall <julia.lawall@inria.fr>
Subject: drivers/hwmon/lm63.c:1086:2-27: opportunity for str_low_high(( data -> config_fan & 0x10 ))
Date: Mon, 04 May 2026 07:27:15 +0800	[thread overview]
Message-ID: <202605040746.0x2CDmMU-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
CC: Shuah Khan <skhan@linuxfoundation.org>
CC: Johannes Berg <johannes@sipsolutions.net>
CC: David Gow <davidgow@google.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   66edb901bf874d9e0787326ba12d3548b2da8700
commit: 031cdd3bc3f369553933c1b0f4cb18000162c8ff kunit: Enable PCI on UML without triggering WARN()
date:   8 months ago
:::::: branch date: 28 hours ago
:::::: commit date: 8 months ago
config: um-randconfig-r061-20260504 (https://download.01.org/0day-ci/archive/20260504/202605040746.0x2CDmMU-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 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
| Fixes: 031cdd3bc3f3 ("kunit: Enable PCI on UML without triggering WARN()")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202605040746.0x2CDmMU-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/hwmon/lm63.c:1086:2-27: opportunity for str_low_high(( data -> config_fan & 0x10 ))

vim +1086 drivers/hwmon/lm63.c

d5957be2f1535b drivers/hwmon/lm63.c     Jean Delvare   2008-07-16  1009  
662bda28328b98 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1010  /*
662bda28328b98 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1011   * Ideally we shouldn't have to initialize anything, since the BIOS
662bda28328b98 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1012   * should have taken care of everything
662bda28328b98 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1013   */
e19eea84078dfa drivers/hwmon/lm63.c     Guenter Roeck  2014-04-04  1014  static void lm63_init_client(struct lm63_data *data)
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1015  {
e19eea84078dfa drivers/hwmon/lm63.c     Guenter Roeck  2014-04-04  1016  	struct i2c_client *client = data->client;
2fd638feb6b39c drivers/hwmon/lm63.c     Guenter Roeck  2014-04-04  1017  	struct device *dev = &client->dev;
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1018  	u8 convrate;
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1019  
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1020  	data->config = i2c_smbus_read_byte_data(client, LM63_REG_CONFIG1);
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1021  	data->config_fan = i2c_smbus_read_byte_data(client,
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1022  						    LM63_REG_CONFIG_FAN);
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1023  
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1024  	/* Start converting if needed */
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1025  	if (data->config & 0x40) { /* standby */
2fd638feb6b39c drivers/hwmon/lm63.c     Guenter Roeck  2014-04-04  1026  		dev_dbg(dev, "Switching to operational mode\n");
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1027  		data->config &= 0xA7;
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1028  		i2c_smbus_write_byte_data(client, LM63_REG_CONFIG1,
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1029  					  data->config);
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1030  	}
409c0b5bdf7d80 drivers/hwmon/lm63.c     Jean Delvare   2012-01-16  1031  	/* Tachometer is always enabled on LM64 */
409c0b5bdf7d80 drivers/hwmon/lm63.c     Jean Delvare   2012-01-16  1032  	if (data->kind == lm64)
409c0b5bdf7d80 drivers/hwmon/lm63.c     Jean Delvare   2012-01-16  1033  		data->config |= 0x04;
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1034  
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1035  	/* We may need pwm1_freq before ever updating the client data */
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1036  	data->pwm1_freq = i2c_smbus_read_byte_data(client, LM63_REG_PWM_FREQ);
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1037  	if (data->pwm1_freq == 0)
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1038  		data->pwm1_freq = 1;
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1039  
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1040  	switch (data->kind) {
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1041  	case lm63:
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1042  	case lm64:
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1043  		data->max_convrate_hz = LM63_MAX_CONVRATE_HZ;
2fe28ab51d2001 drivers/hwmon/lm63.c     Jean Delvare   2012-01-16  1044  		data->lut_size = 8;
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1045  		break;
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1046  	case lm96163:
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1047  		data->max_convrate_hz = LM96163_MAX_CONVRATE_HZ;
2fe28ab51d2001 drivers/hwmon/lm63.c     Jean Delvare   2012-01-16  1048  		data->lut_size = 12;
f496b2d4f181fa drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1049  		data->trutherm
f496b2d4f181fa drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1050  		  = i2c_smbus_read_byte_data(client,
f496b2d4f181fa drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1051  					     LM96163_REG_TRUTHERM) & 0x02;
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1052  		break;
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1053  	}
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1054  	convrate = i2c_smbus_read_byte_data(client, LM63_REG_CONVRATE);
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1055  	if (unlikely(convrate > LM63_MAX_CONVRATE))
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1056  		convrate = LM63_MAX_CONVRATE;
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1057  	data->update_interval = UPDATE_INTERVAL(data->max_convrate_hz,
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1058  						convrate);
04738b2b2f37c1 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1059  
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1060  	/*
e872c91e726e7f drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1061  	 * For LM96163, check if high resolution PWM
e872c91e726e7f drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1062  	 * and unsigned temperature format is enabled.
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1063  	 */
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1064  	if (data->kind == lm96163) {
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1065  		u8 config_enhanced
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1066  		  = i2c_smbus_read_byte_data(client,
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1067  					     LM96163_REG_CONFIG_ENHANCED);
d216f6809eb690 drivers/hwmon/lm63.c     Jean Delvare   2012-01-16  1068  		if (config_enhanced & 0x20)
d216f6809eb690 drivers/hwmon/lm63.c     Jean Delvare   2012-01-16  1069  			data->lut_temp_highres = true;
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1070  		if ((config_enhanced & 0x10)
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1071  		    && !(data->config_fan & 0x08) && data->pwm1_freq == 8)
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1072  			data->pwm_highres = true;
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1073  		if (config_enhanced & 0x08)
e872c91e726e7f drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1074  			data->remote_unsigned = true;
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1075  	}
210961c436d5c5 drivers/hwmon/lm63.c     Guenter Roeck  2012-01-16  1076  
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1077  	/* Show some debug info about the LM63 configuration */
409c0b5bdf7d80 drivers/hwmon/lm63.c     Jean Delvare   2012-01-16  1078  	if (data->kind == lm63)
2fd638feb6b39c drivers/hwmon/lm63.c     Guenter Roeck  2014-04-04  1079  		dev_dbg(dev, "Alert/tach pin configured for %s\n",
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1080  			(data->config & 0x04) ? "tachometer input" :
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1081  			"alert output");
2fd638feb6b39c drivers/hwmon/lm63.c     Guenter Roeck  2014-04-04  1082  	dev_dbg(dev, "PWM clock %s kHz, output frequency %u Hz\n",
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1083  		(data->config_fan & 0x08) ? "1.4" : "360",
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1084  		((data->config_fan & 0x08) ? 700 : 180000) / data->pwm1_freq);
2fd638feb6b39c drivers/hwmon/lm63.c     Guenter Roeck  2014-04-04  1085  	dev_dbg(dev, "PWM output active %s, %s mode\n",
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16 @1086  		(data->config_fan & 0x10) ? "low" : "high",
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1087  		(data->config_fan & 0x20) ? "manual" : "auto");
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1088  }
^1da177e4c3f41 drivers/i2c/chips/lm63.c Linus Torvalds 2005-04-16  1089  

:::::: The code at line 1086 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

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

                 reply	other threads:[~2026-05-03 23:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202605040746.0x2CDmMU-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=julia.lawall@inria.fr \
    --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.