public inbox for linux-kernel@vger.kernel.org
 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

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