media: uvcvideo: Increment intervals pointer at end of parsing
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 5 May 2023 11:45:24 +0000 (14:45 +0300)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 9 Jun 2023 13:11:54 +0000 (14:11 +0100)
commit7691d900b9291417dc6a88262f43176a63536c31
tree4a4b277bc4069a7cad2de559f79e7782eb739d84
parentc9d597b9b7ef9ffcb54051f04798b608edc6850c
media: uvcvideo: Increment intervals pointer at end of parsing

The intervals pointer is incremented for each interval when parsing the
format descriptor. This doesn't cause any issue as such, but gets in the
way of constifying some pointers. Modify the parsing code to index the
intervals pointer as an array and increment it in one go at end of
parsing.

Careful readers will notice that the maxIntervalIndex variable is set to
1 instead of n - 2 when bFrameIntervalType has a zero value. This is
functionally equivalent, as n is equal to 3 in that case.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/usb/uvc/uvc_driver.c