summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorDan Carpenter2016-02-09 12:14:12 +0100
committerMauro Carvalho Chehab2016-02-19 11:10:32 +0100
commit76880b4015f7bdbe73bf2c07e42ef0ba7a343d3e (patch)
tree6046536e7537660cd4f0627e8a5b10968af969cc /drivers/media/usb
parent[media] pvrusb2: correctly handling failed thread run (diff)
downloadkernel-qcow2-linux-76880b4015f7bdbe73bf2c07e42ef0ba7a343d3e.tar.gz
kernel-qcow2-linux-76880b4015f7bdbe73bf2c07e42ef0ba7a343d3e.tar.xz
kernel-qcow2-linux-76880b4015f7bdbe73bf2c07e42ef0ba7a343d3e.zip
[media] usb/cpia2_core: clean up a min_t() cast
It makes sense to make the min_t() cast unsigned here since we don't really want negative sizes. Making it signed causes a static checker warning in Smatch. Smatch knows "fw->size - i" is positive but it doesn't know that fw->size is less than INT_MAX so in theory casting it to int might lead to a negative. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/cpia2/cpia2_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/usb/cpia2/cpia2_core.c b/drivers/media/usb/cpia2/cpia2_core.c
index 187012ce444b..0310fd6ed103 100644
--- a/drivers/media/usb/cpia2/cpia2_core.c
+++ b/drivers/media/usb/cpia2/cpia2_core.c
@@ -923,7 +923,7 @@ static int apply_vp_patch(struct camera_data *cam)
/* ... followed by the data payload */
for (i = 2; i < fw->size; i += 64) {
cmd.start = 0x0C; /* Data */
- cmd.reg_count = min_t(int, 64, fw->size - i);
+ cmd.reg_count = min_t(uint, 64, fw->size - i);
memcpy(cmd.buffer.block_data, &fw->data[i], cmd.reg_count);
cpia2_send_command(cam, &cmd);
}