[ofa-general] [PATCH] mlx4_core: Fix warning from min()

Roland Dreier rdreier at cisco.com
Fri Jan 9 13:14:45 PST 2009


From: Roland Dreier <rolandd at cisco.com>

Recent cpumask changes changed num_possible_cpus() from returning an int
to returning an unsigned int.  This means that doing

    min(num_possible_cpus(), <int expression>)

now produces a warning like

    drivers/net/mlx4/main.c: In function 'mlx4_enable_msi_x':
    drivers/net/mlx4/main.c:915: warning: comparison of distinct pointer types lacks a cast

Fix this by using min_t(int, ...).

Signed-off-by: Roland Dreier <rolandd at cisco.com>
---
I'll merge this in my next batch...

 drivers/net/mlx4/main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 710c79e..6ef2490 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -912,8 +912,8 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
 	int i;
 
 	if (msi_x) {
-		nreq = min(dev->caps.num_eqs - dev->caps.reserved_eqs,
-			   num_possible_cpus() + 1);
+		nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs,
+			     num_possible_cpus() + 1);
 		entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
 		if (!entries)
 			goto no_msi;
-- 
1.6.0.4




More information about the general mailing list