Skip to contentSkip to conversation

regulator: ab8500: tidy ab8500_regulator_get_mode()

PATCH In review Dan Carpenter 2 participants 2 messages Apr 19, 2018 – Apr 20, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: ab8500: tidy ab8500_regulator_get_mode()

The indenting here is confusing.

Also we don't check "ret". That isn't likely to cause a runtime issue because if it fails here fails then we'd probably return -EINVAL at the end anyway. But it does introduce a static checker warning since "val" is only inititialized on the success path.

drivers/regulator/ab8500.c:429 ab8500_regulator_get_mode()
error: uninitialized symbol 'val'.

drivers/regulator/ab8500.c +4 -1
index 83dba3fbfe0c..4fab417f1803 100644
@@ -425,7 +425,10 @@ static unsigned int ab8500_regulator_get_mode(struct regulator_dev *rdev)
 	if (info->mode_mask) {
 		/* Dedicated register for handling mode */
 		ret = abx500_get_register_interruptible(info->dev,
-		info->mode_bank, info->mode_reg, &val);
+							info->mode_bank,
+							info->mode_reg, &val);
+		if (ret)
+			return ret;
 		val = val & info->mode_mask;
 
 		val_normal = info->mode_val_normal;
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Dan Carpenter

The indenting here is confusing.

Also we don't check "ret". That isn't likely to cause a runtime issue because if it fails here fails then we'd probably return -EINVAL at the end anyway. But it does introduce a static checker warning since "val" is only inititialized on the success path.

drivers/regulator/ab8500.c:429 ab8500_regulator_get_mode()
error: uninitialized symbol 'val'.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog