linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/regulator/core.c: Fixes mapping inside regulator_mode_to_status() and makes it returning -EINVAL on invalid input.
@ 2012-01-09 12:12 Krystian Garbaciak
  2012-01-09 16:14 ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Krystian Garbaciak @ 2012-01-09 12:12 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel

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);


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-01-10 17:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-09 12:12 drivers/regulator/core.c: Fixes mapping inside regulator_mode_to_status() and makes it returning -EINVAL on invalid input Krystian Garbaciak
2012-01-09 16:14 ` Mark Brown
2012-01-09 19:20   ` dd diasemi
2012-01-09 20:07     ` Mark Brown
2012-01-10  0:11       ` dd diasemi
2012-01-10  0:14         ` Mark Brown
2012-01-10 17:09           ` dd diasemi
2012-01-10 17:14             ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).