drivers/i2c/busses/i2c-amd756.c:215:32: sparse: sparse: incorrect type in argument 1 (different base types)
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git i2c/i2c-host-next head: 811e13219d56d9bc13ff73029a917e5e5f8401d4 commit: ec6b1f01db79c76b883453ba1d86b0e251a9ab4d [21/22] i2c: amd756: Fix endianness handling for word data config: m68k-randconfig-r121-20241230 (https://download.01.org/0day-ci/archive/20241231/[email protected]/config) compiler: m68k-linux-gcc (GCC) 14.2.0 reproduce: (https://download.01.org/0day-ci/archive/20241231/[email protected]/reproduce)
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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/i2c/busses/i2c-amd756.c:215:32: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] value @@ got restricted __le16 [usertype] @@ drivers/i2c/busses/i2c-amd756.c:215:32: sparse: expected unsigned short [usertype] value drivers/i2c/busses/i2c-amd756.c:215:32: sparse: got restricted __le16 [usertype] >> drivers/i2c/busses/i2c-amd756.c:260:30: sparse: sparse: cast to restricted __le16 >> drivers/i2c/busses/i2c-amd756.c:260:30: sparse: sparse: cast to restricted __le16 >> drivers/i2c/busses/i2c-amd756.c:260:30: sparse: sparse: cast to restricted __le16 >> drivers/i2c/busses/i2c-amd756.c:260:30: sparse: sparse: cast to restricted __le16
vim +215 drivers/i2c/busses/i2c-amd756.c
180
181 /* Return negative errno on error. */
182 static s32 amd756_access(struct i2c_adapter * adap, u16 addr,
183 unsigned short flags, char read_write,
184 u8 command, int size, union i2c_smbus_data * data)
185 {
186 int i, len;
187 int status;
188
189 switch (size) {
190 case I2C_SMBUS_QUICK:
191 outw_p(((addr & 0x7f) << 1) | (read_write & 0x01),
192 SMB_HOST_ADDRESS);
193 size = AMD756_QUICK;
194 break;
195 case I2C_SMBUS_BYTE:
196 outw_p(((addr & 0x7f) << 1) | (read_write & 0x01),
197 SMB_HOST_ADDRESS);
198 if (read_write == I2C_SMBUS_WRITE)
199 outb_p(command, SMB_HOST_DATA);
200 size = AMD756_BYTE;
201 break;
202 case I2C_SMBUS_BYTE_DATA:
203 outw_p(((addr & 0x7f) << 1) | (read_write & 0x01),
204 SMB_HOST_ADDRESS);
205 outb_p(command, SMB_HOST_COMMAND);
206 if (read_write == I2C_SMBUS_WRITE)
207 outw_p(data->byte, SMB_HOST_DATA);
208 size = AMD756_BYTE_DATA;
209 break;
210 case I2C_SMBUS_WORD_DATA:
211 outw_p(((addr & 0x7f) << 1) | (read_write & 0x01),
212 SMB_HOST_ADDRESS);
213 outb_p(command, SMB_HOST_COMMAND);
214 if (read_write == I2C_SMBUS_WRITE)
> 215 outw_p(cpu_to_le16(data->word), SMB_HOST_DATA);
216 size = AMD756_WORD_DATA;
217 break;
218 case I2C_SMBUS_BLOCK_DATA:
219 outw_p(((addr & 0x7f) << 1) | (read_write & 0x01),
220 SMB_HOST_ADDRESS);
221 outb_p(command, SMB_HOST_COMMAND);
222 if (read_write == I2C_SMBUS_WRITE) {
223 len = data->block[0];
224 if (len < 0)
225 len = 0;
226 if (len > 32)
227 len = 32;
228 outw_p(len, SMB_HOST_DATA);
229 /* i = inw_p(SMBHSTCNT); Reset SMBBLKDAT */
230 for (i = 1; i <= len; i++)
231 outb_p(data->block[i],
232 SMB_HOST_BLOCK_DATA);
233 }
234 size = AMD756_BLOCK_DATA;
235 break;
236 default:
237 dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
238 return -EOPNOTSUPP;
239 }
240
241 /* How about enabling interrupts... */
242 outw_p(size & GE_CYC_TYPE_MASK, SMB_GLOBAL_ENABLE);
243
244 status = amd756_transaction(adap);
245 if (status)
246 return status;
247
248 if ((read_write == I2C_SMBUS_WRITE) || (size == AMD756_QUICK))
249 return 0;
250
251
252 switch (size) {
253 case AMD756_BYTE:
254 data->byte = inw_p(SMB_HOST_DATA);
255 break;
256 case AMD756_BYTE_DATA:
257 data->byte = inw_p(SMB_HOST_DATA);
258 break;
259 case AMD756_WORD_DATA:
> 260 data->word = le16_to_cpu(inw_p(SMB_HOST_DATA)); 261 break;
262 case AMD756_BLOCK_DATA:
263 data->block[0] = inw_p(SMB_HOST_DATA) & 0x3f;
264 if(data->block[0] > 32)
265 data->block[0] = 32;
266 /* i = inw_p(SMBHSTCNT); Reset SMBBLKDAT */
267 for (i = 1; i <= data->block[0]; i++)
268 data->block[i] = inb_p(SMB_HOST_BLOCK_DATA);
269 break;
270 }
271
272 return 0;
273 }
274
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki