lkml.org 
[lkml]   [2024]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] MIPS: ralink: Use min() to fix Coccinelle warning
Date
Fixes the following Coccinelle/coccicheck warning reported by
minmax.cocci:

WARNING opportunity for min()

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
arch/mips/ralink/timer.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/mips/ralink/timer.c b/arch/mips/ralink/timer.c
index 54094f6e033e..d271ac98312a 100644
--- a/arch/mips/ralink/timer.c
+++ b/arch/mips/ralink/timer.c
@@ -75,11 +75,7 @@ static int rt_timer_request(struct rt_timer *rt)

static int rt_timer_config(struct rt_timer *rt, unsigned long divisor)
{
- if (rt->timer_freq < divisor)
- rt->timer_div = rt->timer_freq;
- else
- rt->timer_div = divisor;
-
+ rt->timer_div = min(rt->timer_freq, divisor);
rt_timer_w32(rt, TIMER_REG_TMR0LOAD, rt->timer_freq / rt->timer_div);

return 0;
--
2.44.0

\
 
 \ /
  Last update: 2024-05-27 16:31    [W:0.036 / U:1.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site