[PATCH 4/4] net: mvpp2: Use field just assigned in error test
Andrew Goodbody
andrew.goodbody at linaro.org
Tue Aug 5 16:18:19 CEST 2025
In mvpp2_probe the code attempts to get a value for "gop-port-id" and
assigns it to port->gop_id but it then tests port->id for being equal to
-1. That is an impossible test as port->id is a field of type u8 so
cannot be negative. Change the test to port->gop_id.
This issue was found by Smatch.
Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
drivers/net/mvpp2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index 3a3510f603a..f9e979c4d58 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -5353,7 +5353,7 @@ static int mvpp2_probe(struct udevice *dev)
} else {
port->gop_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
"gop-port-id", -1);
- if (port->id == -1) {
+ if (port->gop_id == -1) {
dev_err(dev, "missing gop-port-id value\n");
return -EINVAL;
}
--
2.39.5
More information about the U-Boot
mailing list