diff mbox series

tee: optee: ffa: Fix missing-field-initializers warning

Message ID 20240627051125.24084-1-mark-pk.tsai@mediatek.com (mailing list archive)
State New
Headers show
Series tee: optee: ffa: Fix missing-field-initializers warning | expand

Commit Message

Mark-PK Tsai (蔡沛剛) June 27, 2024, 5:11 a.m. UTC
The 'missing-field-initializers' warning was reported
when building with W=2.
This patch ensures that the remaining fields of
'ffa_send_direct_data' are zero-initialized.

Signed-off-by: ming-jen.chang <ming-jen.chang@mediatek.com>
Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
---
 drivers/tee/optee/ffa_abi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jens Wiklander June 27, 2024, 6:19 a.m. UTC | #1
Hi,

On Thu, Jun 27, 2024 at 7:11 AM Mark-PK Tsai <mark-pk.tsai@mediatek.com> wrote:
>
> The 'missing-field-initializers' warning was reported
> when building with W=2.
> This patch ensures that the remaining fields of
> 'ffa_send_direct_data' are zero-initialized.
>
> Signed-off-by: ming-jen.chang <ming-jen.chang@mediatek.com>
> Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
> ---
>  drivers/tee/optee/ffa_abi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
> index 3235e1c719e8..1aa995752682 100644
> --- a/drivers/tee/optee/ffa_abi.c
> +++ b/drivers/tee/optee/ffa_abi.c
> @@ -660,7 +660,7 @@ static bool optee_ffa_api_is_compatbile(struct ffa_device *ffa_dev,
>                                         const struct ffa_ops *ops)
>  {
>         const struct ffa_msg_ops *msg_ops = ops->msg_ops;
> -       struct ffa_send_direct_data data = { OPTEE_FFA_GET_API_VERSION };
> +       struct ffa_send_direct_data data = { OPTEE_FFA_GET_API_VERSION, 0, 0, 0, 0 };

Please use designated initializers to avoid listing all the zeroes, so
this would become:
        struct ffa_send_direct_data data = {
                .data0 = OPTEE_FFA_GET_API_VERSION,
        };

The same for the other changes further down in this patch. There is an
example in for instance enable_async_notif().

>         int rc;
>
>         msg_ops->mode_32bit_set(ffa_dev);
> @@ -677,7 +677,7 @@ static bool optee_ffa_api_is_compatbile(struct ffa_device *ffa_dev,
>                 return false;
>         }
>
> -       data = (struct ffa_send_direct_data){ OPTEE_FFA_GET_OS_VERSION };
> +       data = (struct ffa_send_direct_data){ OPTEE_FFA_GET_OS_VERSION, 0, 0, 0, 0 };
>         rc = msg_ops->sync_send_receive(ffa_dev, &data);
>         if (rc) {
>                 pr_err("Unexpected error %d\n", rc);
> @@ -698,7 +698,7 @@ static bool optee_ffa_exchange_caps(struct ffa_device *ffa_dev,
>                                     unsigned int *rpc_param_count,
>                                     unsigned int *max_notif_value)
>  {
> -       struct ffa_send_direct_data data = { OPTEE_FFA_EXCHANGE_CAPABILITIES };
> +       struct ffa_send_direct_data data = { OPTEE_FFA_EXCHANGE_CAPABILITIES, 0, 0, 0, 0 };
>         int rc;
>
>         rc = ops->msg_ops->sync_send_receive(ffa_dev, &data);
> --
> 2.18.0
>

Thanks,
Jens
diff mbox series

Patch

diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
index 3235e1c719e8..1aa995752682 100644
--- a/drivers/tee/optee/ffa_abi.c
+++ b/drivers/tee/optee/ffa_abi.c
@@ -660,7 +660,7 @@  static bool optee_ffa_api_is_compatbile(struct ffa_device *ffa_dev,
 					const struct ffa_ops *ops)
 {
 	const struct ffa_msg_ops *msg_ops = ops->msg_ops;
-	struct ffa_send_direct_data data = { OPTEE_FFA_GET_API_VERSION };
+	struct ffa_send_direct_data data = { OPTEE_FFA_GET_API_VERSION, 0, 0, 0, 0 };
 	int rc;
 
 	msg_ops->mode_32bit_set(ffa_dev);
@@ -677,7 +677,7 @@  static bool optee_ffa_api_is_compatbile(struct ffa_device *ffa_dev,
 		return false;
 	}
 
-	data = (struct ffa_send_direct_data){ OPTEE_FFA_GET_OS_VERSION };
+	data = (struct ffa_send_direct_data){ OPTEE_FFA_GET_OS_VERSION, 0, 0, 0, 0 };
 	rc = msg_ops->sync_send_receive(ffa_dev, &data);
 	if (rc) {
 		pr_err("Unexpected error %d\n", rc);
@@ -698,7 +698,7 @@  static bool optee_ffa_exchange_caps(struct ffa_device *ffa_dev,
 				    unsigned int *rpc_param_count,
 				    unsigned int *max_notif_value)
 {
-	struct ffa_send_direct_data data = { OPTEE_FFA_EXCHANGE_CAPABILITIES };
+	struct ffa_send_direct_data data = { OPTEE_FFA_EXCHANGE_CAPABILITIES, 0, 0, 0, 0 };
 	int rc;
 
 	rc = ops->msg_ops->sync_send_receive(ffa_dev, &data);