Shunt resistance values greater than the chip's calibration factor make no
sense since the actual value written to the register equals:
<calibration factor> / <shunt>
Bail-out from ina2xx_probe() if the configured value is greater than the
calibration factor.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
data->config = &ina2xx_config[data->kind];
data->client = client;
- if (data->rshunt <= 0)
+ if (data->rshunt <= 0 ||
+ data->rshunt > data->config->calibration_factor)
return -ENODEV;
ret = ina2xx_init(data);