Skip to contentSkip to conversation

remoteproc: qcom: fix initializers for qcom_mss_reg_res array

PATCH Applied Arnd Bergmann 2 participants 2 messages Feb 1, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remoteproc: qcom: fix initializers for qcom_mss_reg_res array

The recently added initialization is rather unusual because it uses a constructor for a variable-length array to assign a constant structure to a member that uses a fixed-length array. This confuses clang and breaks the build.

drivers/remoteproc/qcom_q6v5_pil.c:1024:18: error: incompatible pointer types initializing 'const char *' with an expression of type
:%s 'struct qcom_mss_reg_res [4]' [-Werror,-Wincompatible-pointer-types]

        .proxy_supply = (struct qcom_mss_reg_res[]) {
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/remoteproc/qcom_q6v5_pil.c:1024:18: warning: suggest braces around initialization of subobject [-Wmissing-braces]
        .proxy_supply = (struct qcom_mss_reg_res[]) {
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We can either turn this constructor into a regular initializer by removing the 'struct qcom_mss_reg_res[])', or we can make the array variable length.

The latter approach is used for the arrays of strings in the same structure, so let's use that here too.

Fixes 19f902b53b47 ("remoteproc: qcom: Initialize and enable proxy and active regulators.")
---
 drivers/remoteproc/qcom_q6v5_pil.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/qcom_q6v5_pil.c +2 -2
index 9a5149573298..8d60ad2a2851 100644
@@ -107,8 +107,8 @@ struct qcom_mss_reg_res {
 
 struct rproc_hexagon_res {
 	const char *hexagon_mba_image;
-	struct qcom_mss_reg_res proxy_supply[4];
-	struct qcom_mss_reg_res active_supply[2];
+	struct qcom_mss_reg_res *proxy_supply;
+	struct qcom_mss_reg_res *active_supply;
 	char **proxy_clk_names;
 	char **active_clk_names;
 };
Signature · 1 line
2.9.0
#1 lore raw
Quoted 12 lines · Arnd Bergmann

The recently added initialization is rather unusual because it uses a constructor for a variable-length array to assign a constant structure to a member that uses a fixed-length array. This confuses clang and breaks the build.

drivers/remoteproc/qcom_q6v5_pil.c:1024:18: error: incompatible pointer types initializing 'const char *' with an expression of type
:%s 'struct qcom_mss_reg_res [4]' [-Werror,-Wincompatible-pointer-types]

        .proxy_supply = (struct qcom_mss_reg_res[]) {
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/remoteproc/qcom_q6v5_pil.c:1024:18: warning: suggest braces around initialization of subobject [-Wmissing-braces]
        .proxy_supply = (struct qcom_mss_reg_res[]) {
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines

We can either turn this constructor into a regular initializer by removing the 'struct qcom_mss_reg_res[])', or we can make the array variable length.

The latter approach is used for the arrays of strings in the same structure, so let's use that here too.

Fixes 19f902b53b47 ("remoteproc: qcom: Initialize and enable proxy and active regulators.")

Looked at it, but figured it wasn't worth an extra respin...

Applied.

Thanks,
Bjorn

Quoted 22 lines
---
 drivers/remoteproc/qcom_q6v5_pil.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/qcom_q6v5_pil.c +2 -2
index 9a5149573298..8d60ad2a2851 100644
@@ -107,8 +107,8 @@ struct qcom_mss_reg_res {
 
 struct rproc_hexagon_res {
 	const char *hexagon_mba_image;
-	struct qcom_mss_reg_res proxy_supply[4];
-	struct qcom_mss_reg_res active_supply[2];
+	struct qcom_mss_reg_res *proxy_supply;
+	struct qcom_mss_reg_res *active_supply;
 	char **proxy_clk_names;
 	char **active_clk_names;
 };
Signature · 1 line
2.9.0