Commit 9313eb4b authored by Jay Fenlason's avatar Jay Fenlason Committed by David S. Miller

cxgb3: Fix warning about using rcu_dereference when not in a rcu-locked section

It is about using rcu_dereference() when not in a rcu-locked section. It only
happens on initialization hence fix the initialization to not rcu_dereference()
Signed-off-by: default avatarJay Fenlason <fenlason@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f1238261
...@@ -1246,6 +1246,7 @@ int cxgb3_offload_activate(struct adapter *adapter) ...@@ -1246,6 +1246,7 @@ int cxgb3_offload_activate(struct adapter *adapter)
struct tid_range stid_range, tid_range; struct tid_range stid_range, tid_range;
struct mtutab mtutab; struct mtutab mtutab;
unsigned int l2t_capacity; unsigned int l2t_capacity;
struct l2t_data *l2td;
t = kzalloc(sizeof(*t), GFP_KERNEL); t = kzalloc(sizeof(*t), GFP_KERNEL);
if (!t) if (!t)
...@@ -1261,8 +1262,8 @@ int cxgb3_offload_activate(struct adapter *adapter) ...@@ -1261,8 +1262,8 @@ int cxgb3_offload_activate(struct adapter *adapter)
goto out_free; goto out_free;
err = -ENOMEM; err = -ENOMEM;
RCU_INIT_POINTER(dev->l2opt, t3_init_l2t(l2t_capacity)); l2td = t3_init_l2t(l2t_capacity);
if (!L2DATA(dev)) if (!l2td)
goto out_free; goto out_free;
natids = min(tid_range.num / 2, MAX_ATIDS); natids = min(tid_range.num / 2, MAX_ATIDS);
...@@ -1279,6 +1280,7 @@ int cxgb3_offload_activate(struct adapter *adapter) ...@@ -1279,6 +1280,7 @@ int cxgb3_offload_activate(struct adapter *adapter)
INIT_LIST_HEAD(&t->list_node); INIT_LIST_HEAD(&t->list_node);
t->dev = dev; t->dev = dev;
RCU_INIT_POINTER(dev->l2opt, l2td);
T3C_DATA(dev) = t; T3C_DATA(dev) = t;
dev->recv = process_rx; dev->recv = process_rx;
dev->neigh_update = t3_l2t_update; dev->neigh_update = t3_l2t_update;
...@@ -1294,8 +1296,7 @@ int cxgb3_offload_activate(struct adapter *adapter) ...@@ -1294,8 +1296,7 @@ int cxgb3_offload_activate(struct adapter *adapter)
return 0; return 0;
out_free_l2t: out_free_l2t:
t3_free_l2t(L2DATA(dev)); t3_free_l2t(l2td);
RCU_INIT_POINTER(dev->l2opt, NULL);
out_free: out_free:
kfree(t); kfree(t);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment