Re: [PATCH 1/3] mxl692: MaxLinear 692 ATSC demod-tuner driver

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

 



Hi Brad,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v5.7 next-20200612]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Brad-Love/MaxLinear-mxl692-demod-tuner-Hauppauge-usb-QuadHD/20200613-024056
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-s002-20200612 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-250-g42323db3-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

>> drivers/media/dvb-frontends/mxl692.c:223:27: sparse: sparse: invalid assignment: +=
>> drivers/media/dvb-frontends/mxl692.c:223:27: sparse:    left side has type unsigned int
>> drivers/media/dvb-frontends/mxl692.c:223:27: sparse:    right side has type restricted __be32
   drivers/media/dvb-frontends/mxl692.c:227:27: sparse: sparse: invalid assignment: +=
   drivers/media/dvb-frontends/mxl692.c:227:27: sparse:    left side has type unsigned int
   drivers/media/dvb-frontends/mxl692.c:227:27: sparse:    right side has type restricted __be32
>> drivers/media/dvb-frontends/mxl692.c:231:16: sparse: sparse: cast to restricted __be32
>> drivers/media/dvb-frontends/mxl692.c:231:16: sparse: sparse: cast to restricted __be32
>> drivers/media/dvb-frontends/mxl692.c:231:16: sparse: sparse: cast to restricted __be32
>> drivers/media/dvb-frontends/mxl692.c:231:16: sparse: sparse: cast to restricted __be32
>> drivers/media/dvb-frontends/mxl692.c:231:16: sparse: sparse: cast to restricted __be32
>> drivers/media/dvb-frontends/mxl692.c:231:16: sparse: sparse: cast to restricted __be32
>> drivers/media/dvb-frontends/mxl692.c:249:14: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] temp @@     got restricted __be32 [usertype] @@
>> drivers/media/dvb-frontends/mxl692.c:249:14: sparse:     expected unsigned int [usertype] temp
>> drivers/media/dvb-frontends/mxl692.c:249:14: sparse:     got restricted __be32 [usertype]
>> drivers/media/dvb-frontends/mxl692.c:293:44: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] @@     got restricted __le32 [usertype] @@
>> drivers/media/dvb-frontends/mxl692.c:293:44: sparse:     expected unsigned int [usertype]
>> drivers/media/dvb-frontends/mxl692.c:293:44: sparse:     got restricted __le32 [usertype]

vim +223 drivers/media/dvb-frontends/mxl692.c

   217	
   218	static u32 mxl692_checksum(u8 *buffer, u32 size)
   219	{
   220		u32 ix, remainder = 0, cur_cksum = 0;
   221	
   222		for (ix = 0; ix < size / 4; ix++)
 > 223			cur_cksum += cpu_to_be32(*(u32 *)(buffer +
   224						 (ix * sizeof(u32))));
   225		remainder = size % 4;
   226		if (remainder > 0)
   227			cur_cksum += cpu_to_be32(*((u32 *)&buffer[size - remainder]));
   228	
   229		cur_cksum ^= 0xDEADBEEF;
   230	
 > 231		return be32_to_cpu(cur_cksum);
   232	}
   233	
   234	static int mxl692_validate_fw_header(const u8 *buffer, u32 buf_len)
   235	{
   236		int status = 0;
   237		u32 ix, temp = 0;
   238		u32 *local_buf = NULL;
   239	
   240		if (buffer[0] != 0x4D || buffer[1] != 0x31 ||
   241		    buffer[2] != 0x10 || buffer[3] != 0x02 ||
   242		    buffer[4] != 0x40 || buffer[5] != 0x00 ||
   243		    buffer[6] != 0x00 || buffer[7] != 0x80) {
   244			status = -EINVAL;
   245			goto err_finish;
   246		}
   247	
   248		local_buf = (u32 *)(buffer + 8);
 > 249		temp = cpu_to_be32(*(u32 *)local_buf);
   250	
   251		if ((buf_len - 16) != (temp >> 8)) {
   252			status = -EINVAL;
   253			goto err_finish;
   254		}
   255	
   256		temp = 0;
   257		for (ix = 16; ix < buf_len; ix++)
   258			temp += buffer[ix];
   259	
   260		if ((u8)temp != buffer[11])
   261			status = -EINVAL;
   262	err_finish:
   263		if (status)
   264			pr_err("%s failed! %d\n", __func__, status);
   265		return status;
   266	}
   267	
   268	static int mxl692_write_fw_block(struct mxl692_dev *dev, const u8 *buffer,
   269					 u32 buf_len, u32 *index)
   270	{
   271		int status = 0;
   272		u32 ix = 0, total_len = 0, addr = 0, chunk_len = 0, prevchunk_len = 0;
   273		u8 local_buf[MXL_EAGLE_MAX_I2C_PACKET_SIZE] = {}, *plocal_buf = NULL;
   274		int payload_max = MXL_EAGLE_MAX_I2C_PACKET_SIZE - MXL_EAGLE_I2C_MHEADER_SIZE;
   275	
   276		ix = *index;
   277	
   278		if (buffer[ix] == 0x53) {
   279			total_len = buffer[ix + 1] << 16 | buffer[ix + 2] << 8 | buffer[ix + 3];
   280			total_len = (total_len + 3) & ~3;
   281			addr     = buffer[ix + 4] << 24 | buffer[ix + 5] << 16 |
   282				   buffer[ix + 6] << 8 | buffer[ix + 7];
   283			ix      += MXL_EAGLE_FW_SEGMENT_HEADER_SIZE;
   284	
   285			while ((total_len > 0) && (status == 0)) {
   286				plocal_buf = local_buf;
   287				chunk_len  = (total_len < payload_max) ?
   288						total_len : payload_max;
   289	
   290				*plocal_buf++ = 0xFC;
   291				*plocal_buf++ = chunk_len + sizeof(u32);
   292	
 > 293				*(u32 *)plocal_buf = cpu_to_le32(addr + prevchunk_len);
   294				plocal_buf += sizeof(u32);
   295	
   296				memcpy(plocal_buf, &buffer[ix], chunk_len);
   297				convert_endian(chunk_len, plocal_buf);
   298	
   299				if (mxl692_i2c_write(dev, local_buf,
   300				    (chunk_len + MXL_EAGLE_I2C_MHEADER_SIZE)) < 0) {
   301					status = -EREMOTEIO;
   302					break;
   303				}
   304	
   305				prevchunk_len += chunk_len;
   306				total_len -= chunk_len;
   307				ix += chunk_len;
   308			}
   309			*index = ix;
   310		} else {
   311			status = -EINVAL;
   312		}
   313	
   314		if (status)
   315			dev_err(&dev->i2c_client->dev, "err %d\n", status);
   316	
   317		return status;
   318	}
   319	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux