[coreboot-gerrit] Change in coreboot[master]: drivers/storage: Fix data flow issues detected by checkpatch

Lee Leahy (Code Review) gerrit at coreboot.org
Mon Mar 27 21:40:00 CEST 2017


Lee Leahy has uploaded a new change for review. ( https://review.coreboot.org/19010 )

Change subject: drivers/storage: Fix data flow issues detected by checkpatch
......................................................................

drivers/storage: Fix data flow issues detected by checkpatch

Fix the following error and warnings detected by checkpatch.pl:

ERROR: trailing statements should be on next line
WARNING: else is not generally useful after a break or return
WARNING: long udelay - prefer mdelay; see arch/arm/include/asm/delay.h

These change are expected to change the binary.

The following errors detected by checkpatch are false positives:
ERROR: need consistent spacing around '*' (ctx:WxV)
ERROR: Macros with complex values should be enclosed in parentheses

TEST=None

Change-Id: Ib55bb89196d81ffb3602a04664e5be3911096d8d
Signed-off-by: Lee Leahy <Leroy.P.Leahy at intel.com>
---
M src/drivers/storage/mmc.c
M src/drivers/storage/sdhci.c
M src/include/device/mmc.h
3 files changed, 10 insertions(+), 11 deletions(-)


  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/19010/1

diff --git a/src/drivers/storage/mmc.c b/src/drivers/storage/mmc.c
index 93daba0..62ebff3 100644
--- a/src/drivers/storage/mmc.c
+++ b/src/drivers/storage/mmc.c
@@ -1064,8 +1064,7 @@
 
 	if ((cmd.response[0] & 0xff) != 0xaa)
 		return MMC_UNUSABLE_ERR;
-	else
-		media->version = SD_VERSION_2;
+	media->version = SD_VERSION_2;
 	return 0;
 }
 
diff --git a/src/drivers/storage/sdhci.c b/src/drivers/storage/sdhci.c
index 53de31b..be06940 100644
--- a/src/drivers/storage/sdhci.c
+++ b/src/drivers/storage/sdhci.c
@@ -373,10 +373,8 @@
 		if (mono_time_after(&current, &end)) {
 			if (host->quirks & SDHCI_QUIRK_BROKEN_R1B)
 				return 0;
-			else {
-				printf("Timeout for status update!\n");
-				return MMC_TIMEOUT;
-			}
+			printf("Timeout for status update!\n");
+			return MMC_TIMEOUT;
 		}
 	} while ((stat & mask) != mask);
 
@@ -724,7 +722,7 @@
 	/* Set timeout to maximum, shouldn't happen if everything's right. */
 	sdhci_writeb(host, 0xe, SDHCI_TIMEOUT_CONTROL);
 
-	udelay(10000);
+	mdelay(10);
 	return 0;
 }
 
diff --git a/src/include/device/mmc.h b/src/include/device/mmc.h
index fa74ec4..afc3cf2 100644
--- a/src/include/device/mmc.h
+++ b/src/include/device/mmc.h
@@ -331,10 +331,12 @@
 #define __mmc_trace	(IS_ENABLED(CONFIG_MMC_TRACE))
 
 // Debug functions.
-#define mmc_debug(format...) \
-		while (__mmc_debug) { printf("mmc: " format); break; }
-#define mmc_trace(format...) \
-		while (__mmc_trace) { printf(format); break; }
+#define mmc_debug(format...)			\
+		if (__mmc_debug)		\
+			printf("mmc: " format)
+#define mmc_trace(format...)		\
+		if (__mmc_trace)	\
+			printf(format)
 #define mmc_error(format...) printf("mmc: ERROR: " format)
 
 #endif /* __DEVICE_MMC_H__ */

-- 
To view, visit https://review.coreboot.org/19010
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib55bb89196d81ffb3602a04664e5be3911096d8d
Gerrit-PatchSet: 1
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Lee Leahy <leroy.p.leahy at intel.com>



More information about the coreboot-gerrit mailing list