Re: [groeck-staging:hwmon-next 33/45] drivers/hwmon/pmbus/lm25066.c:483:15: warning: cast to smaller integer type 'enum chips' from 'const void *'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/8/21 3:00 PM, kernel test robot wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
head:   574d7bfb7324c9a11cf6c0e58960022da6eca2f1
commit: c49bc1bcda2408ec16601b98d981f1d38f947f29 [33/45] hwmon: (pmbus/lm25066) Add OF device ID table
config: x86_64-randconfig-r001-20211008 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 8ed2e8e04ff42eb4d8009999ae1fd341a30bf6c0)
reproduce (this is a W=1 build):
         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
         chmod +x ~/bin/make.cross
         # https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?id=c49bc1bcda2408ec16601b98d981f1d38f947f29
         git remote add groeck-staging https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
         git fetch --no-tags groeck-staging hwmon-next
         git checkout c49bc1bcda2408ec16601b98d981f1d38f947f29
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/hwmon/pmbus/lm25066.c:483:15: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-enum-cast]
            if (of_id && (enum chips)of_id->data != i2c_id->driver_data)
                         ^~~~~~~~~~~~~~~~~~~~~~~
    1 warning generated.


vim +483 drivers/hwmon/pmbus/lm25066.c

    457	
    458	static int lm25066_probe(struct i2c_client *client)
    459	{
    460		int config;
    461		struct lm25066_data *data;
    462		struct pmbus_driver_info *info;
    463		const struct __coeff *coeff;
    464		const struct of_device_id *of_id;
    465		const struct i2c_device_id *i2c_id;
    466	
    467		if (!i2c_check_functionality(client->adapter,
    468					     I2C_FUNC_SMBUS_READ_BYTE_DATA))
    469			return -ENODEV;
    470	
    471		data = devm_kzalloc(&client->dev, sizeof(struct lm25066_data),
    472				    GFP_KERNEL);
    473		if (!data)
    474			return -ENOMEM;
    475	
    476		config = i2c_smbus_read_byte_data(client, LM25066_DEVICE_SETUP);
    477		if (config < 0)
    478			return config;
    479	
    480		i2c_id = i2c_match_id(lm25066_id, client);
    481	
    482		of_id = of_match_device(lm25066_of_match, &client->dev);
  > 483		if (of_id && (enum chips)of_id->data != i2c_id->driver_data)

Fixed up by replacing typecast with unsigned long.

Guenter

    484			dev_notice(&client->dev, "Device mismatch: %s in device tree, %s detected\n",
    485				   of_id->name, i2c_id->name);
    486	
    487		data->id = i2c_id->driver_data;
    488		info = &data->info;
    489	
    490		info->pages = 1;
    491		info->format[PSC_VOLTAGE_IN] = direct;
    492		info->format[PSC_VOLTAGE_OUT] = direct;
    493		info->format[PSC_CURRENT_IN] = direct;
    494		info->format[PSC_TEMPERATURE] = direct;
    495		info->format[PSC_POWER] = direct;
    496	
    497		info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VMON
    498		  | PMBUS_HAVE_PIN | PMBUS_HAVE_IIN | PMBUS_HAVE_STATUS_INPUT
    499		  | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP | PMBUS_HAVE_SAMPLES;
    500	
    501		if (data->id == lm25056) {
    502			info->func[0] |= PMBUS_HAVE_STATUS_VMON;
    503			info->read_word_data = lm25056_read_word_data;
    504			info->read_byte_data = lm25056_read_byte_data;
    505			data->rlimit = 0x0fff;
    506		} else {
    507			info->func[0] |= PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
    508			info->read_word_data = lm25066_read_word_data;
    509			data->rlimit = 0x0fff;
    510		}
    511		info->write_word_data = lm25066_write_word_data;
    512	
    513		coeff = &lm25066_coeff[data->id][0];
    514		info->m[PSC_TEMPERATURE] = coeff[PSC_TEMPERATURE].m;
    515		info->b[PSC_TEMPERATURE] = coeff[PSC_TEMPERATURE].b;
    516		info->R[PSC_TEMPERATURE] = coeff[PSC_TEMPERATURE].R;
    517		info->m[PSC_VOLTAGE_IN] = coeff[PSC_VOLTAGE_IN].m;
    518		info->b[PSC_VOLTAGE_IN] = coeff[PSC_VOLTAGE_IN].b;
    519		info->R[PSC_VOLTAGE_IN] = coeff[PSC_VOLTAGE_IN].R;
    520		info->m[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].m;
    521		info->b[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].b;
    522		info->R[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].R;
    523		info->R[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].R;
    524		info->R[PSC_POWER] = coeff[PSC_POWER].R;
    525		if (config & LM25066_DEV_SETUP_CL) {
    526			info->m[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN_L].m;
    527			info->b[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN_L].b;
    528			info->m[PSC_POWER] = coeff[PSC_POWER_L].m;
    529			info->b[PSC_POWER] = coeff[PSC_POWER_L].b;
    530		} else {
    531			info->m[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].m;
    532			info->b[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].b;
    533			info->m[PSC_POWER] = coeff[PSC_POWER].m;
    534			info->b[PSC_POWER] = coeff[PSC_POWER].b;
    535		}
    536	
    537		return pmbus_do_probe(client, info);
    538	}
    539	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux