Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2cfa5a04 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

net: treewide use of RCU_INIT_POINTER



rcu_assign_pointer(ptr, NULL) can be safely replaced by
RCU_INIT_POINTER(ptr, NULL)

(old rcu_assign_pointer() macro was testing the NULL value and could
omit the smp_wmb(), but this had to be removed because of compiler
warnings)

Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8c215228
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -409,7 +409,7 @@ static int bnx2_unregister_cnic(struct net_device *dev)
	mutex_lock(&bp->cnic_lock);
	cp->drv_state = 0;
	bnapi->cnic_present = 0;
	rcu_assign_pointer(bp->cnic_ops, NULL);
	RCU_INIT_POINTER(bp->cnic_ops, NULL);
	mutex_unlock(&bp->cnic_lock);
	synchronize_rcu();
	return 0;
+1 −1
Original line number Diff line number Diff line
@@ -11587,7 +11587,7 @@ static int bnx2x_unregister_cnic(struct net_device *dev)

	mutex_lock(&bp->cnic_mutex);
	cp->drv_state = 0;
	rcu_assign_pointer(bp->cnic_ops, NULL);
	RCU_INIT_POINTER(bp->cnic_ops, NULL);
	mutex_unlock(&bp->cnic_mutex);
	synchronize_rcu();
	kfree(bp->cnic_kwq);
+3 −3
Original line number Diff line number Diff line
@@ -506,7 +506,7 @@ int cnic_unregister_driver(int ulp_type)
	}
	read_unlock(&cnic_dev_lock);

	rcu_assign_pointer(cnic_ulp_tbl[ulp_type], NULL);
	RCU_INIT_POINTER(cnic_ulp_tbl[ulp_type], NULL);

	mutex_unlock(&cnic_lock);
	synchronize_rcu();
@@ -579,7 +579,7 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
	}
	mutex_lock(&cnic_lock);
	if (rcu_dereference(cp->ulp_ops[ulp_type])) {
		rcu_assign_pointer(cp->ulp_ops[ulp_type], NULL);
		RCU_INIT_POINTER(cp->ulp_ops[ulp_type], NULL);
		cnic_put(dev);
	} else {
		pr_err("%s: device not registered to this ulp type %d\n",
@@ -5134,7 +5134,7 @@ static void cnic_stop_hw(struct cnic_dev *dev)
		}
		cnic_shutdown_rings(dev);
		clear_bit(CNIC_F_CNIC_UP, &dev->flags);
		rcu_assign_pointer(cp->ulp_ops[CNIC_ULP_L4], NULL);
		RCU_INIT_POINTER(cp->ulp_ops[CNIC_ULP_L4], NULL);
		synchronize_rcu();
		cnic_cm_shutdown(dev);
		cp->stop_hw(dev);
+2 −2
Original line number Diff line number Diff line
@@ -1301,7 +1301,7 @@ int cxgb3_offload_activate(struct adapter *adapter)

out_free_l2t:
	t3_free_l2t(L2DATA(dev));
	rcu_assign_pointer(dev->l2opt, NULL);
	RCU_INIT_POINTER(dev->l2opt, NULL);
out_free:
	kfree(t);
	return err;
@@ -1329,7 +1329,7 @@ void cxgb3_offload_deactivate(struct adapter *adapter)
	rcu_read_lock();
	d = L2DATA(tdev);
	rcu_read_unlock();
	rcu_assign_pointer(tdev->l2opt, NULL);
	RCU_INIT_POINTER(tdev->l2opt, NULL);
	call_rcu(&d->rcu_head, clean_l2_data);
	if (t->nofail_skb)
		kfree_skb(t->nofail_skb);
+4 −4
Original line number Diff line number Diff line
@@ -145,8 +145,8 @@ static void macvtap_put_queue(struct macvtap_queue *q)
	if (vlan) {
		int index = get_slot(vlan, q);

		rcu_assign_pointer(vlan->taps[index], NULL);
		rcu_assign_pointer(q->vlan, NULL);
		RCU_INIT_POINTER(vlan->taps[index], NULL);
		RCU_INIT_POINTER(q->vlan, NULL);
		sock_put(&q->sk);
		--vlan->numvtaps;
	}
@@ -223,8 +223,8 @@ static void macvtap_del_queues(struct net_device *dev)
					      lockdep_is_held(&macvtap_lock));
		if (q) {
			qlist[j++] = q;
			rcu_assign_pointer(vlan->taps[i], NULL);
			rcu_assign_pointer(q->vlan, NULL);
			RCU_INIT_POINTER(vlan->taps[i], NULL);
			RCU_INIT_POINTER(q->vlan, NULL);
			vlan->numvtaps--;
		}
	}
Loading