linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] regulator: qcom-rpm: signedness bug in probe()
@ 2015-01-28 19:15 Dan Carpenter
  2015-01-28 19:43 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-01-28 19:15 UTC (permalink / raw)
  To: Liam Girdwood, Bjorn Andersson; +Cc: Mark Brown, linux-kernel, kernel-janitors

"force_mode" is a u32 so it is never "< 0", but because of type
promotion then comparing "== -1" will do what we want.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/regulator/qcom_rpm-regulator.c b/drivers/regulator/qcom_rpm-regulator.c
index edd0a17..ec540aa 100644
--- a/drivers/regulator/qcom_rpm-regulator.c
+++ b/drivers/regulator/qcom_rpm-regulator.c
@@ -769,7 +769,7 @@ static int rpm_reg_probe(struct platform_device *pdev)
 			break;
 		}
 
-		if (force_mode < 0) {
+		if (force_mode == -1) {
 			dev_err(&pdev->dev, "invalid force mode\n");
 			return -EINVAL;
 		}

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

* Re: [patch] regulator: qcom-rpm: signedness bug in probe()
  2015-01-28 19:15 [patch] regulator: qcom-rpm: signedness bug in probe() Dan Carpenter
@ 2015-01-28 19:43 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-01-28 19:43 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Liam Girdwood, Bjorn Andersson, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 204 bytes --]

On Wed, Jan 28, 2015 at 10:15:31PM +0300, Dan Carpenter wrote:
> "force_mode" is a u32 so it is never "< 0", but because of type
> promotion then comparing "== -1" will do what we want.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2015-01-29  3:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 19:15 [patch] regulator: qcom-rpm: signedness bug in probe() Dan Carpenter
2015-01-28 19:43 ` 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).