lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1326111140.22107.9.camel@sw-eng-lt-dc-vm2>
Date:	Mon, 09 Jan 2012 12:12:20 +0000
From:	Krystian Garbaciak <dd.diasemi@...il.com>
To:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc:	linux-kernel@...r.kernel.org
Subject: drivers/regulator/core.c: Fixes mapping inside
 regulator_mode_to_status() and makes it returning -EINVAL on invalid input.

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ