Commit bdfb5765 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

can: af_can: remove NULL-ptr checks from users of can_dev_rcv_lists_find()

Since using the "struct can_ml_priv" for the per device "struct
dev_rcv_lists" the call can_dev_rcv_lists_find() cannot fail anymore.
This patch simplifies af_can by removing the NULL pointer checks from
the dev_rcv_lists returned by can_dev_rcv_lists_find().
Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 8df9ffb8
...@@ -462,7 +462,6 @@ int can_rx_register(struct net *net, struct net_device *dev, canid_t can_id, ...@@ -462,7 +462,6 @@ int can_rx_register(struct net *net, struct net_device *dev, canid_t can_id,
spin_lock(&net->can.rcvlists_lock); spin_lock(&net->can.rcvlists_lock);
dev_rcv_lists = can_dev_rcv_lists_find(net, dev); dev_rcv_lists = can_dev_rcv_lists_find(net, dev);
if (dev_rcv_lists) {
rcv_list = can_rcv_list_find(&can_id, &mask, dev_rcv_lists); rcv_list = can_rcv_list_find(&can_id, &mask, dev_rcv_lists);
rcv->can_id = can_id; rcv->can_id = can_id;
...@@ -479,11 +478,6 @@ int can_rx_register(struct net *net, struct net_device *dev, canid_t can_id, ...@@ -479,11 +478,6 @@ int can_rx_register(struct net *net, struct net_device *dev, canid_t can_id,
rcv_lists_stats->rcv_entries++; rcv_lists_stats->rcv_entries++;
rcv_lists_stats->rcv_entries_max = max(rcv_lists_stats->rcv_entries_max, rcv_lists_stats->rcv_entries_max = max(rcv_lists_stats->rcv_entries_max,
rcv_lists_stats->rcv_entries); rcv_lists_stats->rcv_entries);
} else {
kmem_cache_free(rcv_cache, rcv);
err = -ENODEV;
}
spin_unlock(&net->can.rcvlists_lock); spin_unlock(&net->can.rcvlists_lock);
return err; return err;
...@@ -530,12 +524,6 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id, ...@@ -530,12 +524,6 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id,
spin_lock(&net->can.rcvlists_lock); spin_lock(&net->can.rcvlists_lock);
dev_rcv_lists = can_dev_rcv_lists_find(net, dev); dev_rcv_lists = can_dev_rcv_lists_find(net, dev);
if (!dev_rcv_lists) {
pr_err("BUG: receive list not found for dev %s, id %03X, mask %03X\n",
DNAME(dev), can_id, mask);
goto out;
}
rcv_list = can_rcv_list_find(&can_id, &mask, dev_rcv_lists); rcv_list = can_rcv_list_find(&can_id, &mask, dev_rcv_lists);
/* Search the receiver list for the item to delete. This should /* Search the receiver list for the item to delete. This should
...@@ -668,7 +656,6 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev) ...@@ -668,7 +656,6 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev)
/* find receive list for this device */ /* find receive list for this device */
dev_rcv_lists = can_dev_rcv_lists_find(net, dev); dev_rcv_lists = can_dev_rcv_lists_find(net, dev);
if (dev_rcv_lists)
matches += can_rcv_filter(dev_rcv_lists, skb); matches += can_rcv_filter(dev_rcv_lists, skb);
rcu_read_unlock(); rcu_read_unlock();
......
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