[U-Boot] [PATCH 2/5] mmc: initialize mmc_cmd with 0

Peng Fan van.freenix at gmail.com
Thu Aug 11 13:00:02 CEST 2016


Using {0} to initialize mmc_cmd, before filling the structure.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
Cc: Jaehoon Chung <jh80.chung at samsung.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Bin Meng <bmeng.cn at gmail.com>
Cc: Stefan Wahren <stefan.wahren at i2se.com>
Cc: Clemens Gruber <clemens.gruber at pqgruber.com>
Cc: Kever Yang <kever.yang at rock-chips.com>
Cc: Eric Nelson <eric at nelint.com>
Cc: Stephen Warren <swarren at nvidia.com>
---
 drivers/mmc/mmc.c       | 28 ++++++++++++++--------------
 drivers/mmc/mmc_write.c |  4 ++--
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index efe517a..21bd0dc 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -139,7 +139,7 @@ int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 
 int mmc_send_status(struct mmc *mmc, int timeout)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	int err, retries = 5;
 
 	cmd.cmdidx = MMC_CMD_SEND_STATUS;
@@ -183,7 +183,7 @@ int mmc_send_status(struct mmc *mmc, int timeout)
 
 int mmc_set_blocklen(struct mmc *mmc, int len)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 
 	if (mmc->ddr_mode)
 		return 0;
@@ -198,7 +198,7 @@ int mmc_set_blocklen(struct mmc *mmc, int len)
 static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start,
 			   lbaint_t blkcnt)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	struct mmc_data data;
 
 	if (blkcnt > 1)
@@ -291,7 +291,7 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 
 static int mmc_go_idle(struct mmc *mmc)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	int err;
 
 	udelay(1000);
@@ -314,7 +314,7 @@ static int sd_send_op_cond(struct mmc *mmc)
 {
 	int timeout = 1000;
 	int err;
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 
 	while (1) {
 		cmd.cmdidx = MMC_CMD_APP_CMD;
@@ -380,7 +380,7 @@ static int sd_send_op_cond(struct mmc *mmc)
 
 static int mmc_send_op_cond_iter(struct mmc *mmc, int use_arg)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	int err;
 
 	cmd.cmdidx = MMC_CMD_SEND_OP_COND;
@@ -422,7 +422,7 @@ static int mmc_send_op_cond(struct mmc *mmc)
 
 static int mmc_complete_op_cond(struct mmc *mmc)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	int timeout = 1000;
 	uint start;
 	int err;
@@ -466,7 +466,7 @@ static int mmc_complete_op_cond(struct mmc *mmc)
 
 static int mmc_send_ext_csd(struct mmc *mmc, u8 *ext_csd)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	struct mmc_data data;
 	int err;
 
@@ -487,7 +487,7 @@ static int mmc_send_ext_csd(struct mmc *mmc, u8 *ext_csd)
 
 int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	int timeout = 1000;
 	int ret;
 
@@ -820,7 +820,7 @@ int mmc_getcd(struct mmc *mmc)
 
 static int sd_switch(struct mmc *mmc, int mode, int group, u8 value, u8 *resp)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	struct mmc_data data;
 
 	/* Switch the frequency */
@@ -842,7 +842,7 @@ static int sd_switch(struct mmc *mmc, int mode, int group, u8 value, u8 *resp)
 static int sd_change_freq(struct mmc *mmc)
 {
 	int err;
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	ALLOC_CACHE_ALIGN_BUFFER(uint, scr, 2);
 	ALLOC_CACHE_ALIGN_BUFFER(uint, switch_status, 16);
 	struct mmc_data data;
@@ -952,7 +952,7 @@ retry_scr:
 static int sd_read_ssr(struct mmc *mmc)
 {
 	int err, i;
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	ALLOC_CACHE_ALIGN_BUFFER(uint, ssr, 16);
 	struct mmc_data data;
 	int timeout;
@@ -1072,7 +1072,7 @@ static int mmc_startup(struct mmc *mmc)
 	int err, i;
 	uint mult, freq;
 	u64 cmult, csize, capacity;
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN);
 	ALLOC_CACHE_ALIGN_BUFFER(u8, test_csd, MMC_MAX_BLOCK_LEN);
 	int timeout = 1000;
@@ -1555,7 +1555,7 @@ static int mmc_startup(struct mmc *mmc)
 
 static int mmc_send_if_cond(struct mmc *mmc)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	int err;
 
 	cmd.cmdidx = SD_CMD_SEND_IF_COND;
diff --git a/drivers/mmc/mmc_write.c b/drivers/mmc/mmc_write.c
index 0f8b5c7..4149f4a 100644
--- a/drivers/mmc/mmc_write.c
+++ b/drivers/mmc/mmc_write.c
@@ -17,7 +17,7 @@
 
 static ulong mmc_erase_t(struct mmc *mmc, ulong start, lbaint_t blkcnt)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	ulong end;
 	int err, start_cmd, end_cmd;
 
@@ -119,7 +119,7 @@ unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
 static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t start,
 		lbaint_t blkcnt, const void *src)
 {
-	struct mmc_cmd cmd;
+	struct mmc_cmd cmd = {0};
 	struct mmc_data data;
 	int timeout = 1000;
 
-- 
2.6.2



More information about the U-Boot mailing list