diff mbox series

firmware: qcom: avoid struct initialization warning on gcc-4.8

Message ID 20200429085753.3277336-1-arnd@arndb.de (mailing list archive)
State New, archived
Headers show
Series firmware: qcom: avoid struct initialization warning on gcc-4.8 | expand

Commit Message

Arnd Bergmann April 29, 2020, 8:57 a.m. UTC
When building with old compilers like gcc-4.8, a struct initializer
can warn about invalid syntax:

drivers/firmware/qcom_scm-smc.c: In function 'scm_smc_call':
drivers/firmware/qcom_scm-smc.c:94:9: error: missing braces around initializer [-Werror=missing-braces]
  struct arm_smccc_args smc = {0};
         ^
drivers/firmware/qcom_scm-smc.c:94:9: error: (near initialization for 'smc.args') [-Werror=missing-braces]
cc1: some warnings being treated as errors
drivers/firmware/qcom_scm-legacy.c: In function 'scm_legacy_call':
drivers/firmware/qcom_scm-legacy.c:139:9: error: missing braces around initializer [-Werror=missing-braces]
  struct arm_smccc_args smc = {0};
         ^
drivers/firmware/qcom_scm-legacy.c:139:9: error: (near initialization for 'smc.args') [-Werror=missing-braces]

Change this to use the empty initializer extension that
works with all compilers.

Fixes: 590e92809a58 ("firmware: qcom_scm-32: Move SMCCC register filling to qcom_scm_call")
Fixes: 3f951ea627da ("firmware: qcom_scm-64: Move SMC register filling to qcom_scm_call_smccc")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/firmware/qcom_scm-legacy.c | 2 +-
 drivers/firmware/qcom_scm-smc.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Stephen Boyd April 29, 2020, 7:37 p.m. UTC | #1
Quoting Arnd Bergmann (2020-04-29 01:57:33)
> When building with old compilers like gcc-4.8, a struct initializer
> can warn about invalid syntax:
> 
> drivers/firmware/qcom_scm-smc.c: In function 'scm_smc_call':
> drivers/firmware/qcom_scm-smc.c:94:9: error: missing braces around initializer [-Werror=missing-braces]
>   struct arm_smccc_args smc = {0};
>          ^
> drivers/firmware/qcom_scm-smc.c:94:9: error: (near initialization for 'smc.args') [-Werror=missing-braces]
> cc1: some warnings being treated as errors
> drivers/firmware/qcom_scm-legacy.c: In function 'scm_legacy_call':
> drivers/firmware/qcom_scm-legacy.c:139:9: error: missing braces around initializer [-Werror=missing-braces]
>   struct arm_smccc_args smc = {0};
>          ^
> drivers/firmware/qcom_scm-legacy.c:139:9: error: (near initialization for 'smc.args') [-Werror=missing-braces]
> 
> Change this to use the empty initializer extension that
> works with all compilers.
> 
> Fixes: 590e92809a58 ("firmware: qcom_scm-32: Move SMCCC register filling to qcom_scm_call")
> Fixes: 3f951ea627da ("firmware: qcom_scm-64: Move SMC register filling to qcom_scm_call_smccc")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>
diff mbox series

Patch

diff --git a/drivers/firmware/qcom_scm-legacy.c b/drivers/firmware/qcom_scm-legacy.c
index eba6b60bfb61..5aa15fcf01d9 100644
--- a/drivers/firmware/qcom_scm-legacy.c
+++ b/drivers/firmware/qcom_scm-legacy.c
@@ -136,7 +136,7 @@  int scm_legacy_call(struct device *dev, const struct qcom_scm_desc *desc,
 	unsigned int i;
 	struct scm_legacy_command *cmd;
 	struct scm_legacy_response *rsp;
-	struct arm_smccc_args smc = {0};
+	struct arm_smccc_args smc = { };
 	struct arm_smccc_res smc_res;
 	const size_t cmd_len = arglen * sizeof(__le32);
 	const size_t resp_len = MAX_QCOM_SCM_RETS * sizeof(__le32);
diff --git a/drivers/firmware/qcom_scm-smc.c b/drivers/firmware/qcom_scm-smc.c
index 497c13ba98d6..81818ea74824 100644
--- a/drivers/firmware/qcom_scm-smc.c
+++ b/drivers/firmware/qcom_scm-smc.c
@@ -91,7 +91,7 @@  int scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc,
 			(qcom_scm_convention == SMC_CONVENTION_ARM_32) ?
 			ARM_SMCCC_SMC_32 : ARM_SMCCC_SMC_64;
 	struct arm_smccc_res smc_res;
-	struct arm_smccc_args smc = {0};
+	struct arm_smccc_args smc = { };
 
 	smc.args[0] = ARM_SMCCC_CALL_VAL(
 		smccc_call_type,