lkml.org 
[lkml]   [2021]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mmc: core: Use ternery for return value in mmc_vdd_to_ocrbitnum()
Date
From: Yue Hu <huyue2@yulong.com>

Just simplify the code.

Signed-off-by: Yue Hu <huyue2@yulong.com>
---
drivers/mmc/core/core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index f194940..600543c 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1028,9 +1028,7 @@ static int mmc_vdd_to_ocrbitnum(int vdd, bool low_bits)

/* Base 2000 mV, step 100 mV, bit's base 8. */
bit = (vdd - 2000) / 100 + 8;
- if (bit > max_bit)
- return max_bit;
- return bit;
+ return (bit > max_bit) ? max_bit : bit;
}

/**
--
1.9.1
\
 
 \ /
  Last update: 2021-05-20 10:29    [W:0.030 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site