]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] usb/cpia2_core: clean up a min_t() cast
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 9 Feb 2016 11:14:12 +0000 (09:14 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 19 Feb 2016 10:10:32 +0000 (08:10 -0200)
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>
drivers/media/usb/cpia2/cpia2_core.c

index 187012ce444bd2aef05235335c32e8302b3d3727..0310fd6ed1033ced21cf8c509666852b17c128b7 100644 (file)
@@ -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);
        }