Skip to contentSkip to conversation

arm: socfpga: agilex5: Coverity issue cleanup in jtag_usercode check

PATCH In review [email protected] 2 participants 2 messages Apr 29, 2025 – May 2, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: socfpga: agilex5: Coverity issue cleanup in jtag_usercode check

From: Tingting Meng <[email protected]>

A redundant comparison (jtag_usercode >= 0) was removed from the condition checking jtag_usercode. Since jtag_usercode is an unsigned integer, the check for non-negativity was always true. The code was simplified to resolve the Coverity warning.

---
 arch/arm/mach-socfpga/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-socfpga/board.c +1 -1
index 8506d510413..8bec7c6dccd 100644
@@ -133,7 +133,7 @@ u8 socfpga_get_board_id(void)
 
 	if (jtag_usercode == DEFAULT_JTAG_USERCODE) {
 		debug("JTAG Usercode is not set. Default Board ID to 0\n");
-	} else if (jtag_usercode >= 0 && jtag_usercode <= 255) {
+	} else if (jtag_usercode <= 255) {
 		board_id = jtag_usercode;
 		debug("Valid JTAG Usercode. Set Board ID to %u\n", board_id);
 	} else {
Signature · 1 line
2.25.1
Reviewed-by Tien Fong Chee on v1 1/1
#1 lore raw
Quoted 42 lines

-----Original Message-----
From: Meng, Tingting <[email protected]>
Sent: Tuesday, April 29, 2025 5:56 PM
To: [email protected]
Cc: Marek Vasut <[email protected]>; Chee, Tien Fong <[email protected]>; Meng, Tingting <[email protected]>; Hea, Kok Kiang <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Rosdi, Danish Ahmad <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>
Subject: [PATCH v1 1/1] arm: socfpga: agilex5: Coverity issue cleanup in jtag_usercode check

From: Tingting Meng <[email protected]>

A redundant comparison (jtag_usercode >= 0) was removed from the condition checking jtag_usercode. Since jtag_usercode is an unsigned integer, the check for non-negativity was always true. The code was simplified to resolve the Coverity warning.

---
 arch/arm/mach-socfpga/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach- renamed from arch/arm/mach-socfpga/board.c +0 -0

socfpga/board.c index 8506d510413..8bec7c6dccd 100644

arch/arm/mach-socfpga/board.c +1 -1
@@ -133,7 +133,7 @@ u8 socfpga_get_board_id(void)
 
 	if (jtag_usercode == DEFAULT_JTAG_USERCODE) {
 		debug("JTAG Usercode is not set. Default Board ID to 0\n");
-	} else if (jtag_usercode >= 0 && jtag_usercode <= 255) {
+	} else if (jtag_usercode <= 255) {
 		board_id = jtag_usercode;
 		debug("Valid JTAG Usercode. Set Board ID to %u\n",
 board_id);
Quoted 3 lines

} else {
--
2.25.1

Best regards,
Tien Fong