linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: replace ternary operator with min()
@ 2022-10-23 12:44 KaiLong Wang
  2022-10-24  4:33 ` Russell Currey
  2022-10-26 12:07 ` kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: KaiLong Wang @ 2022-10-23 12:44 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy, farosas, mirq-linux,
	dmitry.osipenko, kda, naveen.n.rao
  Cc: linuxppc-dev, linux-kernel

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@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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-02  9:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-23 12:44 [PATCH] powerpc: replace ternary operator with min() KaiLong Wang
2022-10-24  4:33 ` Russell Currey
2022-11-02  9:23   ` Christophe Leroy
2022-10-26 12:07 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).