hwmon: (ads7828) Check return value of devm_regmap_init_i2c
authorAxel Lin <axel.lin@ingics.com>
Tue, 10 Feb 2015 10:24:07 +0000 (18:24 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 23 Feb 2015 04:10:30 +0000 (20:10 -0800)
devm_regmap_init_i2c() can fail, thus add return value checking.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/ads7828.c

index bce4e9ff21bff76606484f0a04ad1bf52b1ffee2..6c99ee7bafa3fdf47d6479b7198697ec835a23e8 100644 (file)
@@ -147,6 +147,9 @@ static int ads7828_probe(struct i2c_client *client,
                                                    &ads2830_regmap_config);
        }
 
+       if (IS_ERR(data->regmap))
+               return PTR_ERR(data->regmap);
+
        data->cmd_byte = ext_vref ? ADS7828_CMD_PD1 : ADS7828_CMD_PD3;
        if (!diff_input)
                data->cmd_byte |= ADS7828_CMD_SD_SE;