diff mbox series

mmc: core: Use ternery for return value in mmc_vdd_to_ocrbitnum()

Message ID 20210520082837.2129-1-zbestahu@gmail.com
State New
Headers show
Series mmc: core: Use ternery for return value in mmc_vdd_to_ocrbitnum() | expand

Commit Message

Yue Hu May 20, 2021, 8:28 a.m. UTC
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(-)

Comments

Christoph Hellwig May 24, 2021, 11:42 a.m. UTC | #1
On Thu, May 20, 2021 at 04:28:37PM +0800, Yue Hu wrote:
> From: Yue Hu <huyue2@yulong.com>

> 

> Just simplify the code.


The original version is way easier to read.
diff mbox series

Patch

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;
 }
 
 /**