[PATCH] powerpc: replace ternary operator with min()

KaiLong Wang wangkailong at jari.cn
Sun Oct 23 23:44:20 AEDT 2022


Fix the following coccicheck warning:

arch/powerpc/xmon/xmon.c:2987: WARNING opportunity for min()
arch/powerpc/xmon/xmon.c:2583: WARNING opportunity for min()

Signed-off-by: KaiLong Wang <wangkailong at jari.cn>
---
 arch/powerpc/xmon/xmon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index f51c882bf902..a7751cd2cc9d 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2580,7 +2580,7 @@ static void xmon_rawdump (unsigned long adrs, long ndump)
 	unsigned char temp[16];
 
 	for (n = ndump; n > 0;) {
-		r = n < 16? n: 16;
+		r = min(n, 16);
 		nr = mread(adrs, temp, r);
 		adrs += nr;
 		for (m = 0; m < r; ++m) {
@@ -2984,7 +2984,7 @@ prdump(unsigned long adrs, long ndump)
 	for (n = ndump; n > 0;) {
 		printf(REG, adrs);
 		putchar(' ');
-		r = n < 16? n: 16;
+		r = min(n, 16);
 		nr = mread(adrs, temp, r);
 		adrs += nr;
 		for (m = 0; m < r; ++m) {
-- 
2.25.1


More information about the Linuxppc-dev mailing list