Skip to contentSkip to conversation

stm32: remove redundant 'else if'

PATCH New Heinrich Schuchardt 2 participants 2 messages Jul 30, 2017 – Aug 14, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stm32: remove redundant 'else if'

The if in the else branch is superfluous.
We can use a simple if.

The problem was indicated by cppcheck.

---
 arch/arm/mach-stm32/stm32f1/flash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-stm32/stm32f1/flash.c +1 -1
index 7d41f63733..9dc8e1198f 100644
@@ -49,7 +49,7 @@ unsigned long flash_init(void)
 	if (size <= STM32_MAX_BANK) {
 		banks = 1;
 		flash_info[0].sector_count = size >> 1;
-	} else if (size > STM32_MAX_BANK) {
+	} else {
 		banks = 2;
 		flash_info[0].sector_count = STM32_MAX_BANK >> 1;
 		flash_info[1].sector_count = (size - STM32_MAX_BANK) >> 1;
Signature · 1 line
2.13.2
#1 lore raw

PATCH 1/1 stm32: remove redundant 'else if'

Quoted 6 lines · xypron.glpk at gmx.de

The if in the else branch is superfluous.
We can use a simple if.

The problem was indicated by cppcheck.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170813/c680fd29/attachment.sig>