linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [net-next, netfilter] mlx5: avoid unused variable warning
@ 2019-07-12  8:57 Arnd Bergmann
  2019-07-12 18:25 ` Saeed Mahameed
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2019-07-12  8:57 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky, David S. Miller
  Cc: Arnd Bergmann, Pablo Neira Ayuso, Jakub Kicinski, Tariq Toukan,
	Or Gerlitz, Maxim Mikityanskiy, Eran Ben Elisha, Aya Levin,
	netdev, linux-rdma, linux-kernel

Without CONFIG_MLX5_ESWITCH we get a harmless warning:

drivers/net/ethernet/mellanox/mlx5/core/en_main.c:3467:21: error: unused variable 'priv' [-Werror,-Wunused-variable]
        struct mlx5e_priv *priv = netdev_priv(dev);

Hide the declaration in the same #ifdef as its usage.

Fixes: 4e95bc268b91 ("net: flow_offload: add flow_block_cb_setup_simple()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 6d0ae87c8ded..b562ba904ea1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3464,7 +3464,9 @@ static LIST_HEAD(mlx5e_block_cb_list);
 static int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,
 			  void *type_data)
 {
+#ifdef CONFIG_MLX5_ESWITCH
 	struct mlx5e_priv *priv = netdev_priv(dev);
+#endif
 
 	switch (type) {
 #ifdef CONFIG_MLX5_ESWITCH
-- 
2.20.0


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

* Re: [PATCH] [net-next, netfilter] mlx5: avoid unused variable warning
  2019-07-12  8:57 [PATCH] [net-next, netfilter] mlx5: avoid unused variable warning Arnd Bergmann
@ 2019-07-12 18:25 ` Saeed Mahameed
  0 siblings, 0 replies; 2+ messages in thread
From: Saeed Mahameed @ 2019-07-12 18:25 UTC (permalink / raw)
  To: davem, arnd, leon
  Cc: Aya Levin, Maxim Mikityanskiy, Or Gerlitz, pablo, Tariq Toukan,
	linux-rdma, jakub.kicinski, Eran Ben Elisha, netdev,
	linux-kernel

On Fri, 2019-07-12 at 10:57 +0200, Arnd Bergmann wrote:
> Without CONFIG_MLX5_ESWITCH we get a harmless warning:
> 
> drivers/net/ethernet/mellanox/mlx5/core/en_main.c:3467:21: error:
> unused variable 'priv' [-Werror,-Wunused-variable]
>         struct mlx5e_priv *priv = netdev_priv(dev);
> 

Hi Arnd,

thanks for your patch, a similar patch that addresses this issue was
already submitted and applied to net-next [1]

[1] https://www.spinics.net/lists/netdev/msg585433.html

> Hide the declaration in the same #ifdef as its usage.
> 
> Fixes: 4e95bc268b91 ("net: flow_offload: add
> flow_block_cb_setup_simple()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> index 6d0ae87c8ded..b562ba904ea1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -3464,7 +3464,9 @@ static LIST_HEAD(mlx5e_block_cb_list);
>  static int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type
> type,
>  			  void *type_data)
>  {
> +#ifdef CONFIG_MLX5_ESWITCH
>  	struct mlx5e_priv *priv = netdev_priv(dev);
> +#endif
>  
>  	switch (type) {
>  #ifdef CONFIG_MLX5_ESWITCH

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

end of thread, other threads:[~2019-07-12 18:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12  8:57 [PATCH] [net-next, netfilter] mlx5: avoid unused variable warning Arnd Bergmann
2019-07-12 18:25 ` Saeed Mahameed

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).