diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2016-12-19 20:51:18 +0900 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2017-02-13 13:19:54 +0100 |
commit | c7836d1593b87cb813c58cf64e08b052ebbe2a78 (patch) | |
tree | e3eb7869a2b2cee2eecca2157213c896184b7630 /drivers/mmc/host/sdhci.c | |
parent | 164b50b353908c79b551b3658e37f29182e2c0b3 (diff) | |
download | lwn-c7836d1593b87cb813c58cf64e08b052ebbe2a78.tar.gz lwn-c7836d1593b87cb813c58cf64e08b052ebbe2a78.zip |
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/host/sdhci.c')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 0def99590d16..a2efa25c7f3b 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2021,8 +2021,8 @@ static void sdhci_send_tuning(struct sdhci_host *host, u32 opcode, unsigned long flags) { struct mmc_host *mmc = host->mmc; - struct mmc_command cmd = {0}; - struct mmc_request mrq = {NULL}; + struct mmc_command cmd = {}; + struct mmc_request mrq = {}; cmd.opcode = opcode; cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC; |