소스 검색

regulator: qcom-rpm: signedness bug in probe()

"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>
Signed-off-by: Mark Brown <broonie@kernel.org>
Dan Carpenter 10 년 전
부모
커밋
a412ec2795
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      drivers/regulator/qcom_rpm-regulator.c

+ 1 - 1
drivers/regulator/qcom_rpm-regulator.c

@@ -768,7 +768,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;
 		}