patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [17.11] net/mlx5: fix initialization of struct members
@ 2019-01-22 14:51 Ali Alnubani
  2019-01-23  5:58 ` Yongseok Koh
  0 siblings, 1 reply; 2+ messages in thread
From: Ali Alnubani @ 2019-01-22 14:51 UTC (permalink / raw)
  To: stable; +Cc: Yongseok Koh

[ backported from upstream commit 0c15f3c010322853078c20a2a9926d3fb5986548 ]

This patch fixes compilation errors with meson and the clang
compiler caused by some of the struct members not being
initialized.

```
../drivers/net/mlx5/mlx5_mr.c:345:37: error: missing field 'end'
initializer [-Werror,-Wmissing-field-initializers]
                struct mlx5_mr_cache entry = { 0, };
                                                  ^
../drivers/net/mlx5/mlx5_mr.c:389:36: error: missing field 'end'
initializer [-Werror,-Wmissing-field-initializers]
                        struct mlx5_mr_cache ret = { 0, };
                                                        ^
../drivers/net/mlx5/mlx5_mr.c:691:35: error: missing field 'end'
initializer [-Werror,-Wmissing-field-initializers]
                struct mlx5_mr_cache ret = { 0, };
                                                ^
```

The compilation errors reproduce with
clang version 3.4.2 (tags/RELEASE_34/dot2-final) on RHEL.

Fixes: 87011737b715 ("mlx5: add software counters")

Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5_stats.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 345ed7075..e880d24c5 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -356,10 +356,11 @@ int
 mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
 	struct priv *priv = dev->data->dev_private;
-	struct rte_eth_stats tmp = {0};
+	struct rte_eth_stats tmp;
 	unsigned int i;
 	unsigned int idx;
 
+	memset(&tmp, 0, sizeof(tmp));
 	/* Add software counters. */
 	for (i = 0; (i != priv->rxqs_n); ++i) {
 		struct mlx5_rxq_data *rxq = (*priv->rxqs)[i];
-- 
2.19.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [17.11] net/mlx5: fix initialization of struct members
  2019-01-22 14:51 [dpdk-stable] [17.11] net/mlx5: fix initialization of struct members Ali Alnubani
@ 2019-01-23  5:58 ` Yongseok Koh
  0 siblings, 0 replies; 2+ messages in thread
From: Yongseok Koh @ 2019-01-23  5:58 UTC (permalink / raw)
  To: Ali Alnubani; +Cc: stable

> On Jan 22, 2019, at 11:51 PM, Ali Alnubani <alialnu@mellanox.com> wrote:
> 
> [ backported from upstream commit 0c15f3c010322853078c20a2a9926d3fb5986548 ]
> 
> This patch fixes compilation errors with meson and the clang
> compiler caused by some of the struct members not being
> initialized.
> 
> ```
> ../drivers/net/mlx5/mlx5_mr.c:345:37: error: missing field 'end'
> initializer [-Werror,-Wmissing-field-initializers]
>                struct mlx5_mr_cache entry = { 0, };
>                                                  ^
> ../drivers/net/mlx5/mlx5_mr.c:389:36: error: missing field 'end'
> initializer [-Werror,-Wmissing-field-initializers]
>                        struct mlx5_mr_cache ret = { 0, };
>                                                        ^
> ../drivers/net/mlx5/mlx5_mr.c:691:35: error: missing field 'end'
> initializer [-Werror,-Wmissing-field-initializers]
>                struct mlx5_mr_cache ret = { 0, };
>                                                ^
> ```
> 
> The compilation errors reproduce with
> clang version 3.4.2 (tags/RELEASE_34/dot2-final) on RHEL.
> 
> Fixes: 87011737b715 ("mlx5: add software counters")
> 
> Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
> ---
Applied to stable/17.11

thanks,
Yongseok


> drivers/net/mlx5/mlx5_stats.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
> index 345ed7075..e880d24c5 100644
> --- a/drivers/net/mlx5/mlx5_stats.c
> +++ b/drivers/net/mlx5/mlx5_stats.c
> @@ -356,10 +356,11 @@ int
> mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
> {
> 	struct priv *priv = dev->data->dev_private;
> -	struct rte_eth_stats tmp = {0};
> +	struct rte_eth_stats tmp;
> 	unsigned int i;
> 	unsigned int idx;
> 
> +	memset(&tmp, 0, sizeof(tmp));
> 	/* Add software counters. */
> 	for (i = 0; (i != priv->rxqs_n); ++i) {
> 		struct mlx5_rxq_data *rxq = (*priv->rxqs)[i];
> -- 
> 2.19.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-23  5:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22 14:51 [dpdk-stable] [17.11] net/mlx5: fix initialization of struct members Ali Alnubani
2019-01-23  5:58 ` Yongseok Koh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).