iio: light: lm3533-als: Print error message on invalid resistance
authorBjorn Andersson <bjorn.andersson@sonymobile.com>
Fri, 30 Oct 2015 23:50:39 +0000 (16:50 -0700)
committerJonathan Cameron <jic23@kernel.org>
Sat, 31 Oct 2015 10:05:32 +0000 (10:05 +0000)
Print an error message to indicate that invalid configuration data was
provided in the platform_data, rather than just aborting initialization.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/light/lm3533-als.c

index 076bc46fad034fae0d2e9c99ae40ae0923987d09..e56937c40a189a8f076440c9e2f361755a81cbc8 100644 (file)
@@ -743,8 +743,10 @@ static int lm3533_als_set_resistor(struct lm3533_als *als, u8 val)
 {
        int ret;
 
-       if (val < LM3533_ALS_RESISTOR_MIN || val > LM3533_ALS_RESISTOR_MAX)
+       if (val < LM3533_ALS_RESISTOR_MIN || val > LM3533_ALS_RESISTOR_MAX) {
+               dev_err(&als->pdev->dev, "invalid resistor value\n");
                return -EINVAL;
+       };
 
        ret = lm3533_write(als->lm3533, LM3533_REG_ALS_RESISTOR_SELECT, val);
        if (ret) {