diff mbox series

[media] gspca: First camera mode is skipped

Message ID VI1PR03MB6462531970F4C30703A87A589B910@VI1PR03MB6462.eurprd03.prod.outlook.com
State Accepted
Commit 44d42520df8a67f47c1e47d934d6bcd38d87daac
Headers show
Series [media] gspca: First camera mode is skipped | expand

Commit Message

Florin Tudorache June 28, 2020, 9:24 a.m. UTC
Subject: [PATCH] [media] gspca: First camera mode is skipped

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>
---
 drivers/media/usb/gspca/gspca.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index c1b307bbe540..334c2e8fa0d5 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -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)