gspca: First camera mode is skipped
authorFlorin Tudorache <florin_tudorache@live.com>
Sun, 28 Jun 2020 09:24:47 +0000 (11:24 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sun, 19 Jul 2020 06:16:47 +0000 (08:16 +0200)
If a device supports a resolution in 2 different formats, mode[0] is
skipped on first iteration and a different format is selected.

Example: 320x240/YUYV isn't reachable for OV534/ov772x

Signed-off-by: Florin Tudorache <florin_tudorache@live.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/usb/gspca/gspca.c

index 0566e00..c295f64 100644 (file)
@@ -925,7 +925,7 @@ static int wxh_to_nearest_mode(struct gspca_dev *gspca_dev,
 {
        int i;
 
-       for (i = gspca_dev->cam.nmodes; --i > 0; ) {
+       for (i = gspca_dev->cam.nmodes; --i >= 0; ) {
                if (width >= gspca_dev->cam.cam_mode[i].width
                    && height >= gspca_dev->cam.cam_mode[i].height
                    && pixelformat == gspca_dev->cam.cam_mode[i].pixelformat)