[PATCH v2] pinctrl: single: fix a never true comparison

Dario Binacchi dariobin at libero.it
Thu Apr 22 22:28:56 CEST 2021


As reported by Coverity Scan for Das U-Boot, the 'less-than-zero'
comparison of an unsigned value is never true.

Signed-off-by: Dario Binacchi <dariobin at libero.it>
Reviewed-by: Pratyush Yadav <p.yadav at ti.com>

---

Changes in v2:
- Balance quote in commit message
- Add review tag

 drivers/pinctrl/pinctrl-single.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 48bdd0f6f5..7e1c5bb0a5 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -295,7 +295,7 @@ static int single_configure_pins(struct udevice *dev,
 	func->npins = 0;
 	for (n = 0; n < count; n++, pins++) {
 		offset = fdt32_to_cpu(pins->reg);
-		if (offset < 0 || offset > pdata->offset) {
+		if (offset > pdata->offset) {
 			dev_err(dev, "  invalid register offset 0x%x\n",
 				offset);
 			continue;
@@ -344,7 +344,7 @@ static int single_configure_bits(struct udevice *dev,
 	func->npins = 0;
 	for (n = 0; n < count; n++, pins++) {
 		offset = fdt32_to_cpu(pins->reg);
-		if (offset < 0 || offset > pdata->offset) {
+		if (offset > pdata->offset) {
 			dev_dbg(dev, "  invalid register offset 0x%x\n",
 				offset);
 			continue;
-- 
2.17.1



More information about the U-Boot mailing list