Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: hdpvr: fix smatch warning

drivers/media/usb/hdpvr/hdpvr-i2c.c: drivers/media/usb/hdpvr/hdpvr-i2c.c:78 hdpvr_i2c_read() warn: 'dev->i2c_buf' 4216624615462223872 can't fit into 127 '*data'

dev->i2c_buf is a char array, so you can just use dev->i2c_buf to get the
start address, no need to do &dev->i2c_buf, even though it is the same
address in C. It only confuses smatch.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
d75e77ed a4d3d612

+7 -7
+7 -7
drivers/media/usb/hdpvr/hdpvr-i2c.c
··· 61 61 return -EINVAL; 62 62 63 63 if (wlen) { 64 - memcpy(&dev->i2c_buf, wdata, wlen); 64 + memcpy(dev->i2c_buf, wdata, wlen); 65 65 ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), 66 66 REQTYPE_I2C_WRITE, CTRL_WRITE_REQUEST, 67 - (bus << 8) | addr, 0, &dev->i2c_buf, 67 + (bus << 8) | addr, 0, dev->i2c_buf, 68 68 wlen, 1000); 69 69 if (ret < 0) 70 70 return ret; ··· 72 72 73 73 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), 74 74 REQTYPE_I2C_READ, CTRL_READ_REQUEST, 75 - (bus << 8) | addr, 0, &dev->i2c_buf, len, 1000); 75 + (bus << 8) | addr, 0, dev->i2c_buf, len, 1000); 76 76 77 77 if (ret == len) { 78 - memcpy(data, &dev->i2c_buf, len); 78 + memcpy(data, dev->i2c_buf, len); 79 79 ret = 0; 80 80 } else if (ret >= 0) 81 81 ret = -EIO; ··· 91 91 if (len > sizeof(dev->i2c_buf)) 92 92 return -EINVAL; 93 93 94 - memcpy(&dev->i2c_buf, data, len); 94 + memcpy(dev->i2c_buf, data, len); 95 95 ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), 96 96 REQTYPE_I2C_WRITE, CTRL_WRITE_REQUEST, 97 - (bus << 8) | addr, 0, &dev->i2c_buf, len, 1000); 97 + (bus << 8) | addr, 0, dev->i2c_buf, len, 1000); 98 98 99 99 if (ret < 0) 100 100 return ret; 101 101 102 102 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), 103 103 REQTYPE_I2C_WRITE_STATT, CTRL_READ_REQUEST, 104 - 0, 0, &dev->i2c_buf, 2, 1000); 104 + 0, 0, dev->i2c_buf, 2, 1000); 105 105 106 106 if ((ret == 2) && (dev->i2c_buf[1] == (len - 1))) 107 107 ret = 0;