drivers/regulator/core.c: Fixes mapping insideregulator_mode_to_status() and makes it returning -EINVAL on invalid input.

From: Krystian Garbaciak
Date: Mon Jan 09 2012 - 07:12:28 EST


Minor fix that makes the function working correctly with
REGULATOR_MODE_STANDBY as parameter.
Also, on invalid input (bad mode), it is better to return -EINVAL,
instead of meaningless 0 value (which actually is interpreted as
REGULATOR_STATUS_OFF).

---
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 938398f..45aa874 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2484,10 +2484,10 @@ int regulator_mode_to_status(unsigned int mode)
return REGULATOR_STATUS_NORMAL;
case REGULATOR_MODE_IDLE:
return REGULATOR_STATUS_IDLE;
- case REGULATOR_STATUS_STANDBY:
+ case REGULATOR_MODE_STANDBY:
return REGULATOR_STATUS_STANDBY;
default:
- return 0;
+ return -EINVAL;
}
}
EXPORT_SYMBOL_GPL(regulator_mode_to_status);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/