archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <>
To: Saeed Mahameed <>,
	Leon Romanovsky <>,
	"David S. Miller" <>,
	Jakub Kicinski <>
Cc: Nick Desaulniers <>,,,,,
	Nathan Chancellor <>
Subject: [PATCH net-next] net/mlx5: Use cpumask_available() in mlx5_eq_create_generic()
Date: Thu, 17 Jun 2021 17:03:59 -0700	[thread overview]
Message-ID: <> (raw)

When CONFIG_CPUMASK_OFFSTACK is unset, cpumask_var_t is not a pointer
but a single element array, meaning its address in a structure cannot be
NULL as long as it is not the first element, which it is not. This
results in a clang warning:

drivers/net/ethernet/mellanox/mlx5/core/eq.c:715:14: warning: address of
array 'param->affinity' will always evaluate to 'true'
        if (!param->affinity)
1 warning generated.

The helper cpumask_available was added in commit f7e30f01a9e2 ("cpumask:
Add helper cpumask_available()") to handle situations like this so use
it to keep the meaning of the code the same while resolving the warning.

Fixes: e4e3f24b822f ("net/mlx5: Provide cpumask at EQ creation phase")
Signed-off-by: Nathan Chancellor <>
 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index 7e5b3826eae5..d3356771e628 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -710,7 +710,7 @@ mlx5_eq_create_generic(struct mlx5_core_dev *dev,
 	struct mlx5_eq *eq = kvzalloc(sizeof(*eq), GFP_KERNEL);
 	int err;
-	if (!param->affinity)
+	if (!cpumask_available(param->affinity))
 		return ERR_PTR(-EINVAL);
 	if (!eq)

base-commit: 8fe088bd4fd12f4c8899b51d5bc3daad98767d49

             reply	other threads:[~2021-06-18  0:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18  0:03 Nathan Chancellor [this message]
2021-06-21  8:53 ` Leon Romanovsky
2021-06-22 21:39 ` Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH net-next] net/mlx5: Use cpumask_available() in mlx5_eq_create_generic()' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox