linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mlx4: Use cpumask_available for eq->affinity_mask
@ 2018-09-21  9:44 Nathan Chancellor
  2018-09-23  7:52 ` Tariq Toukan
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2018-09-21  9:44 UTC (permalink / raw)
  To: Tariq Toukan, David S. Miller
  Cc: netdev, linux-rdma, linux-kernel, Nathan Chancellor

Clang warns that the address of a pointer will always evaluated as true
in a boolean context:

drivers/net/ethernet/mellanox/mlx4/eq.c:243:11: warning: address of
array 'eq->affinity_mask' will always evaluate to 'true'
[-Wpointer-bool-conversion]
        if (!eq->affinity_mask || cpumask_empty(eq->affinity_mask))
            ~~~~~^~~~~~~~~~~~~
1 warning generated.

Use cpumask_available, introduced in commit f7e30f01a9e2 ("cpumask: Add
helper cpumask_available()"), which does the proper checking and avoids
this warning.

Link: https://github.com/ClangBuiltLinux/linux/issues/86
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/net/ethernet/mellanox/mlx4/eq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 1f3372c1802e..2df92dbd38e1 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -240,7 +240,8 @@ static void mlx4_set_eq_affinity_hint(struct mlx4_priv *priv, int vec)
 	struct mlx4_dev *dev = &priv->dev;
 	struct mlx4_eq *eq = &priv->eq_table.eq[vec];
 
-	if (!eq->affinity_mask || cpumask_empty(eq->affinity_mask))
+	if (!cpumask_available(eq->affinity_mask) ||
+	    cpumask_empty(eq->affinity_mask))
 		return;
 
 	hint_err = irq_set_affinity_hint(eq->irq, eq->affinity_mask);
-- 
2.19.0


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

* Re: [PATCH] net/mlx4: Use cpumask_available for eq->affinity_mask
  2018-09-21  9:44 [PATCH] net/mlx4: Use cpumask_available for eq->affinity_mask Nathan Chancellor
@ 2018-09-23  7:52 ` Tariq Toukan
  0 siblings, 0 replies; 2+ messages in thread
From: Tariq Toukan @ 2018-09-23  7:52 UTC (permalink / raw)
  To: Nathan Chancellor, Tariq Toukan, David S. Miller
  Cc: netdev, linux-rdma, linux-kernel



On 21/09/2018 12:44 PM, Nathan Chancellor wrote:
> Clang warns that the address of a pointer will always evaluated as true
> in a boolean context:
> 
> drivers/net/ethernet/mellanox/mlx4/eq.c:243:11: warning: address of
> array 'eq->affinity_mask' will always evaluate to 'true'
> [-Wpointer-bool-conversion]
>          if (!eq->affinity_mask || cpumask_empty(eq->affinity_mask))
>              ~~~~~^~~~~~~~~~~~~
> 1 warning generated.
> 
> Use cpumask_available, introduced in commit f7e30f01a9e2 ("cpumask: Add
> helper cpumask_available()"), which does the proper checking and avoids
> this warning.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/86
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>   drivers/net/ethernet/mellanox/mlx4/eq.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
> index 1f3372c1802e..2df92dbd38e1 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/eq.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
> @@ -240,7 +240,8 @@ static void mlx4_set_eq_affinity_hint(struct mlx4_priv *priv, int vec)
>   	struct mlx4_dev *dev = &priv->dev;
>   	struct mlx4_eq *eq = &priv->eq_table.eq[vec];
>   
> -	if (!eq->affinity_mask || cpumask_empty(eq->affinity_mask))
> +	if (!cpumask_available(eq->affinity_mask) ||
> +	    cpumask_empty(eq->affinity_mask))
>   		return;
>   
>   	hint_err = irq_set_affinity_hint(eq->irq, eq->affinity_mask);
> 

Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Thanks.

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

end of thread, other threads:[~2018-09-23  7:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-21  9:44 [PATCH] net/mlx4: Use cpumask_available for eq->affinity_mask Nathan Chancellor
2018-09-23  7:52 ` Tariq Toukan

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