uvc: check ioctl return value for error
authorPaul Elder <paul.elder@ideasonboard.com>
Tue, 12 Jun 2018 05:17:04 +0000 (14:17 +0900)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tue, 12 Jun 2018 18:23:40 +0000 (21:23 +0300)
There is code that is meant to check for the error of an ioctl, but the
return variable that it checks isn't actually assigned from the ioctl.
Assign the return value before checking it.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
[Fixed error message]
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
lib/uvc.c

index f8e913a..695db5b 100644 (file)
--- a/lib/uvc.c
+++ b/lib/uvc.c
@@ -329,10 +329,10 @@ static void uvc_events_process(void *d)
                return;
        }
 
-       ioctl(dev->vdev->fd, UVCIOC_SEND_RESPONSE, &resp);
+       ret = ioctl(dev->vdev->fd, UVCIOC_SEND_RESPONSE, &resp);
        if (ret < 0) {
-               printf("UVCIOC_S_EVENT failed: %s (%d)\n", strerror(errno),
-                       errno);
+               printf("UVCIOC_SEND_RESPONSE failed: %s (%d)\n",
+                      strerror(errno), errno);
                return;
        }
 }