Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: ad7606: exit for invalid fdt dt_schema properties

Fix ad7606_get_chan_config() fdt parsing function to exit for error in
case of invalid dt_schema values.

Idea is to not proceed when there are values that are not allowed under
the dt_schema.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250606-wip-bl-ad7606-calibration-v9-5-6e014a1f92a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Angelo Dureghello and committed by
Jonathan Cameron
9dc4ef3a e986466a

+4 -6
+4 -6
drivers/iio/adc/ad7606.c
··· 319 319 320 320 ret = fwnode_property_read_u32(child, "reg", &reg); 321 321 if (ret) 322 - continue; 322 + return ret; 323 323 324 324 /* channel number (here) is from 1 to num_channels */ 325 - if (reg < 1 || reg > num_channels) { 326 - dev_warn(dev, 327 - "Invalid channel number (ignoring): %d\n", reg); 328 - continue; 329 - } 325 + if (reg < 1 || reg > num_channels) 326 + return -EINVAL; 330 327 328 + /* Loop until we are in the right channel. */ 331 329 if (reg != (ch + 1)) 332 330 continue; 333 331