arm: socfpga: agilex5: Coverity issue cleanup in jtag_usercode check
Subsystems (3)
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
@@ -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
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 injtag_usercodecheckFrom: Tingting Meng <[email protected]>
A redundant comparison (
jtag_usercode>= 0) was removed from the condition checkingjtag_usercode. Sincejtag_usercodeis an unsigned integer, the check for non-negativity was always true. The code was simplified to resolve the Coverity warning.Signed-off-by Tingting Meng <[email protected]>--- 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.cindex8506d510413..8bec7c6dccd100644arch/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