IB/core: Make gid_table_reserve_default() return void
authorParav Pandit <parav@mellanox.com>
Wed, 2 May 2018 10:12:55 +0000 (13:12 +0300)
committerDoug Ledford <dledford@redhat.com>
Wed, 9 May 2018 16:08:21 +0000 (12:08 -0400)
gid_table_reserve_default() always returns zero. Make it return void and
simplify error checking.

rdma_port is already calculated, use that while calling
gid_table_reserve_default() instead of recalculating it.

Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/cache.c

index e337b08de2ffb3cd73b2ea335c6ff0e09375d50a..140fd351764dfc689c0cb0f4d185897a439f002f 100644 (file)
@@ -757,8 +757,8 @@ void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port,
        }
 }
 
-static int gid_table_reserve_default(struct ib_device *ib_dev, u8 port,
-                                    struct ib_gid_table *table)
+static void gid_table_reserve_default(struct ib_device *ib_dev, u8 port,
+                                     struct ib_gid_table *table)
 {
        unsigned int i;
        unsigned long roce_gid_type_mask;
@@ -768,8 +768,7 @@ static int gid_table_reserve_default(struct ib_device *ib_dev, u8 port,
        roce_gid_type_mask = roce_gid_type_mask_support(ib_dev, port);
        num_default_gids = hweight_long(roce_gid_type_mask);
        for (i = 0; i < num_default_gids && i < table->sz; i++) {
-               struct ib_gid_table_entry *entry =
-                       &table->data_vec[i];
+               struct ib_gid_table_entry *entry = &table->data_vec[i];
 
                entry->props |= GID_TABLE_ENTRY_DEFAULT;
                current_gid = find_next_bit(&roce_gid_type_mask,
@@ -777,8 +776,6 @@ static int gid_table_reserve_default(struct ib_device *ib_dev, u8 port,
                                            current_gid);
                entry->attr.gid_type = current_gid++;
        }
-
-       return 0;
 }
 
 static int _gid_table_setup_one(struct ib_device *ib_dev)
@@ -790,19 +787,14 @@ static int _gid_table_setup_one(struct ib_device *ib_dev)
        for (port = 0; port < ib_dev->phys_port_cnt; port++) {
                u8 rdma_port = port + rdma_start_port(ib_dev);
 
-               table =
-                       alloc_gid_table(
+               table = alloc_gid_table(
                                ib_dev->port_immutable[rdma_port].gid_tbl_len);
                if (!table) {
                        err = -ENOMEM;
                        goto rollback_table_setup;
                }
 
-               err = gid_table_reserve_default(ib_dev,
-                                               port + rdma_start_port(ib_dev),
-                                               table);
-               if (err)
-                       goto rollback_table_setup;
+               gid_table_reserve_default(ib_dev, rdma_port, table);
                ib_dev->cache.ports[port].gid = table;
        }