OSDN Git Service

mlx4_core: Check for DPDP violation only when DPDP is not supported
authorYuval Shaia <yuval.shaia@oracle.com>
Sat, 13 Dec 2014 18:18:40 +0000 (10:18 -0800)
committerRoland Dreier <roland@purestorage.com>
Tue, 16 Dec 2014 02:12:29 +0000 (18:12 -0800)
Move check for DPDP out of the loop to make the code more readable.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/net/ethernet/mellanox/mlx4/main.c

index e25436b..629f9f1 100644 (file)
@@ -171,9 +171,9 @@ int mlx4_check_port_params(struct mlx4_dev *dev,
 {
        int i;
 
-       for (i = 0; i < dev->caps.num_ports - 1; i++) {
-               if (port_type[i] != port_type[i + 1]) {
-                       if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_DPDP)) {
+       if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_DPDP)) {
+               for (i = 0; i < dev->caps.num_ports - 1; i++) {
+                       if (port_type[i] != port_type[i + 1]) {
                                mlx4_err(dev, "Only same port types supported on this HCA, aborting\n");
                                return -EINVAL;
                        }