media: i2c: ov7251: Fix link_freq validation loop
authorDave Stevenson <dave.stevenson@raspberrypi.com>
Thu, 17 Feb 2022 15:57:01 +0000 (15:57 +0000)
committerDom Cobley <popcornmix@gmail.com>
Mon, 21 Mar 2022 16:04:44 +0000 (16:04 +0000)
If only one link frequency was configured, then ov7251_check_hwcfg
failed as the conditions weren't checked in the appropriate places.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drivers/media/i2c/ov7251.c

index db3ac10..5de185e 100644 (file)
@@ -1390,14 +1390,14 @@ static int ov7251_check_hwcfg(struct ov7251 *ov7251)
 
        freq_found = false;
        for (i = 0; i < bus_cfg.nr_of_link_frequencies; i++) {
-               if (freq_found)
-                       break;
-
                for (j = 0; j < ARRAY_SIZE(link_freq); j++)
                        if (bus_cfg.link_frequencies[i] == link_freq[j]) {
                                freq_found = true;
                                break;
                        }
+
+               if (freq_found)
+                       break;
        }
 
        if (i == bus_cfg.nr_of_link_frequencies) {