Browse Source

iio: pressure: bmp280: fix wrong pointer passed to PTR_ERR()

PTR_ERR should access the value just tested by IS_ERR, otherwise
the wrong error code will be returned.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Wei Yongjun 9 years ago
parent
commit
bb9947c3a1
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/iio/pressure/bmp280-core.c

+ 1 - 1
drivers/iio/pressure/bmp280-core.c

@@ -970,7 +970,7 @@ int bmp280_common_probe(struct device *dev,
 	data->vdda = devm_regulator_get(dev, "vdda");
 	data->vdda = devm_regulator_get(dev, "vdda");
 	if (IS_ERR(data->vdda)) {
 	if (IS_ERR(data->vdda)) {
 		dev_err(dev, "failed to get VDDA regulator\n");
 		dev_err(dev, "failed to get VDDA regulator\n");
-		ret = PTR_ERR(data->vddd);
+		ret = PTR_ERR(data->vdda);
 		goto out_disable_vddd;
 		goto out_disable_vddd;
 	}
 	}
 	ret = regulator_enable(data->vdda);
 	ret = regulator_enable(data->vdda);