Skip to content

Commit

Permalink
media: i2c: ov5647: Add checks for link frequency
Browse files Browse the repository at this point in the history
Added validation for the link-frequency in the driver.
The new checks ensure that:
- The link-frequency property is present in the device tree
- The number of link frequencies matches the ov5647_link_freqs array size
- The link frequencies in the device tree match the supported
  values in ov5647_link_freqs array

These checks help avoid misconfigurations and prevent
runtime errors due to incorrect declarations

Signed-off-by: Dominik Bajec <[email protected]>
  • Loading branch information
Bajec committed Oct 22, 2024
1 parent 25c0edc commit 2f31f9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/i2c/ov5647.c
Original file line number Diff line number Diff line change
Expand Up @@ -1384,9 +1384,9 @@ static int ov5647_parse_dt(struct device *dev,
}

for (int i = 0; i < ARRAY_SIZE(ov5647_link_freqs); i++) {
if(bus_cfg.link_frequencies[i] != ov5647_link_freqs[i]){
if (bus_cfg.link_frequencies[i] != ov5647_link_freqs[i]) {
dev_err(dev, "no supported link frequency found\n");
goto out;
goto out;
}
}

Expand Down

0 comments on commit 2f31f9c

Please sign in to comment.