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

Peng Fan van.freenix at gmail.com
Fri Aug 12 12:13:34 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 a855acf..7a3a4f8 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -140,7 +140,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;
@@ -184,7 +184,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;
@@ -199,7 +199,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)
@@ -292,7 +292,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);
@@ -315,7 +315,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;
@@ -381,7 +381,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;
@@ -423,7 +423,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;
@@ -467,7 +467,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;
 
@@ -488,7 +488,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;
 
@@ -821,7 +821,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 */
@@ -843,7 +843,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;
@@ -953,7 +953,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 = 3;
@@ -1070,7 +1070,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;
@@ -1553,7 +1553,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