Skip to content

Commit

Permalink
cxgb3: Fix warning about using rcu_dereference when not in a rcu-lock…
Browse files Browse the repository at this point in the history
…ed 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: Jay Fenlason <fenlason@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jay Fenlason authored and David S. Miller committed May 23, 2013
1 parent f123826 commit 9313eb4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,7 @@ int cxgb3_offload_activate(struct adapter *adapter)
struct tid_range stid_range, tid_range;
struct mtutab mtutab;
unsigned int l2t_capacity;
struct l2t_data *l2td;

t = kzalloc(sizeof(*t), GFP_KERNEL);
if (!t)
Expand All @@ -1261,8 +1262,8 @@ int cxgb3_offload_activate(struct adapter *adapter)
goto out_free;

err = -ENOMEM;
RCU_INIT_POINTER(dev->l2opt, t3_init_l2t(l2t_capacity));
if (!L2DATA(dev))
l2td = t3_init_l2t(l2t_capacity);
if (!l2td)
goto out_free;

natids = min(tid_range.num / 2, MAX_ATIDS);
Expand All @@ -1279,6 +1280,7 @@ int cxgb3_offload_activate(struct adapter *adapter)
INIT_LIST_HEAD(&t->list_node);
t->dev = dev;

RCU_INIT_POINTER(dev->l2opt, l2td);
T3C_DATA(dev) = t;
dev->recv = process_rx;
dev->neigh_update = t3_l2t_update;
Expand All @@ -1294,8 +1296,7 @@ int cxgb3_offload_activate(struct adapter *adapter)
return 0;

out_free_l2t:
t3_free_l2t(L2DATA(dev));
RCU_INIT_POINTER(dev->l2opt, NULL);
t3_free_l2t(l2td);
out_free:
kfree(t);
return err;
Expand Down

0 comments on commit 9313eb4

Please sign in to comment.