Skip to contentSkip to conversation

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

PATCH In review Yue Hu 2 participants 2 messages May 20, 2021 – May 24, 2021 MMC, SD and SDIO

lore
Share & tools
lore

Yue Hu

author
#0 lore raw

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

From: Yue Hu <[email protected]>

Just simplify the code.

---
 drivers/mmc/core/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/core/core.c +1 -3
index f194940..600543c 100644
@@ -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;
 }
 
 /**
Signature · 1 line
1.9.1