aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/mmc_test.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2016-12-19 06:51:18 -0500
committerUlf Hansson <ulf.hansson@linaro.org>2017-02-13 07:19:54 -0500
commitc7836d1593b87cb813c58cf64e08b052ebbe2a78 (patch)
treee3eb7869a2b2cee2eecca2157213c896184b7630 /drivers/mmc/core/mmc_test.c
parent164b50b353908c79b551b3658e37f29182e2c0b3 (diff)
mmc: use empty initializer list to zero-clear structures
In the MMC subsystem, we see such initializers that only clears the first member explicitly. For example, struct mmc_request mrq = {NULL}; sets the first member (.sbc) to NULL explicitly. However, this is an unstable form because we may insert a non-pointer member at the top of the struct mmc_request in the future. (if we do so, the compiler will spit warnings.) So, using a designated initializer is preferred coding style. The expression above is equivalent to: struct mmc_request mrq = { .sbc = NULL }; Of course, this does not express our intention. We want to fill all struct members with zeros. Please note struct members are implicitly zero-cleared unless otherwise specified in the initializer. After all, the most reasonable (and stable) form is: struct mmc_request mrq = {}; Do likewise for mmc_command, mmc_data as well. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core/mmc_test.c')
-rw-r--r--drivers/mmc/core/mmc_test.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 3ab6e52d106c..bd8eb9bfc153 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -260,7 +260,7 @@ static int mmc_test_busy(struct mmc_command *cmd)
260static int mmc_test_wait_busy(struct mmc_test_card *test) 260static int mmc_test_wait_busy(struct mmc_test_card *test)
261{ 261{
262 int ret, busy; 262 int ret, busy;
263 struct mmc_command cmd = {0}; 263 struct mmc_command cmd = {};
264 264
265 busy = 0; 265 busy = 0;
266 do { 266 do {
@@ -292,10 +292,10 @@ static int mmc_test_wait_busy(struct mmc_test_card *test)
292static int mmc_test_buffer_transfer(struct mmc_test_card *test, 292static int mmc_test_buffer_transfer(struct mmc_test_card *test,
293 u8 *buffer, unsigned addr, unsigned blksz, int write) 293 u8 *buffer, unsigned addr, unsigned blksz, int write)
294{ 294{
295 struct mmc_request mrq = {0}; 295 struct mmc_request mrq = {};
296 struct mmc_command cmd = {0}; 296 struct mmc_command cmd = {};
297 struct mmc_command stop = {0}; 297 struct mmc_command stop = {};
298 struct mmc_data data = {0}; 298 struct mmc_data data = {};
299 299
300 struct scatterlist sg; 300 struct scatterlist sg;
301 301
@@ -885,10 +885,10 @@ static int mmc_test_simple_transfer(struct mmc_test_card *test,
885 struct scatterlist *sg, unsigned sg_len, unsigned dev_addr, 885 struct scatterlist *sg, unsigned sg_len, unsigned dev_addr,
886 unsigned blocks, unsigned blksz, int write) 886 unsigned blocks, unsigned blksz, int write)
887{ 887{
888 struct mmc_request mrq = {0}; 888 struct mmc_request mrq = {};
889 struct mmc_command cmd = {0}; 889 struct mmc_command cmd = {};
890 struct mmc_command stop = {0}; 890 struct mmc_command stop = {};
891 struct mmc_data data = {0}; 891 struct mmc_data data = {};
892 892
893 mrq.cmd = &cmd; 893 mrq.cmd = &cmd;
894 mrq.data = &data; 894 mrq.data = &data;
@@ -910,10 +910,10 @@ static int mmc_test_simple_transfer(struct mmc_test_card *test,
910static int mmc_test_broken_transfer(struct mmc_test_card *test, 910static int mmc_test_broken_transfer(struct mmc_test_card *test,
911 unsigned blocks, unsigned blksz, int write) 911 unsigned blocks, unsigned blksz, int write)
912{ 912{
913 struct mmc_request mrq = {0}; 913 struct mmc_request mrq = {};
914 struct mmc_command cmd = {0}; 914 struct mmc_command cmd = {};
915 struct mmc_command stop = {0}; 915 struct mmc_command stop = {};
916 struct mmc_data data = {0}; 916 struct mmc_data data = {};
917 917
918 struct scatterlist sg; 918 struct scatterlist sg;
919 919