aboutsummaryrefslogtreecommitdiffstats
path: root/net/can/af_can.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/can/af_can.c')
-rw-r--r--net/can/af_can.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c
index c48e5220bbac..c4e50852c9f4 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -525,7 +525,7 @@ void can_rx_unregister(struct net_device *dev, canid_t can_id, canid_t mask,
525 525
526 d = find_dev_rcv_lists(dev); 526 d = find_dev_rcv_lists(dev);
527 if (!d) { 527 if (!d) {
528 printk(KERN_ERR "BUG: receive list not found for " 528 pr_err("BUG: receive list not found for "
529 "dev %s, id %03X, mask %03X\n", 529 "dev %s, id %03X, mask %03X\n",
530 DNAME(dev), can_id, mask); 530 DNAME(dev), can_id, mask);
531 goto out; 531 goto out;
@@ -546,16 +546,13 @@ void can_rx_unregister(struct net_device *dev, canid_t can_id, canid_t mask,
546 } 546 }
547 547
548 /* 548 /*
549 * Check for bugs in CAN protocol implementations: 549 * Check for bugs in CAN protocol implementations using af_can.c:
550 * If no matching list item was found, the list cursor variable next 550 * 'r' will be NULL if no matching list item was found for removal.
551 * will be NULL, while r will point to the last item of the list.
552 */ 551 */
553 552
554 if (!r) { 553 if (!r) {
555 printk(KERN_ERR "BUG: receive list entry not found for " 554 WARN(1, "BUG: receive list entry not found for dev %s, "
556 "dev %s, id %03X, mask %03X\n", 555 "id %03X, mask %03X\n", DNAME(dev), can_id, mask);
557 DNAME(dev), can_id, mask);
558 r = NULL;
559 goto out; 556 goto out;
560 } 557 }
561 558
@@ -749,8 +746,7 @@ int can_proto_register(const struct can_proto *cp)
749 int err = 0; 746 int err = 0;
750 747
751 if (proto < 0 || proto >= CAN_NPROTO) { 748 if (proto < 0 || proto >= CAN_NPROTO) {
752 printk(KERN_ERR "can: protocol number %d out of range\n", 749 pr_err("can: protocol number %d out of range\n", proto);
753 proto);
754 return -EINVAL; 750 return -EINVAL;
755 } 751 }
756 752
@@ -761,8 +757,7 @@ int can_proto_register(const struct can_proto *cp)
761 mutex_lock(&proto_tab_lock); 757 mutex_lock(&proto_tab_lock);
762 758
763 if (proto_tab[proto]) { 759 if (proto_tab[proto]) {
764 printk(KERN_ERR "can: protocol %d already registered\n", 760 pr_err("can: protocol %d already registered\n", proto);
765 proto);
766 err = -EBUSY; 761 err = -EBUSY;
767 } else 762 } else
768 RCU_INIT_POINTER(proto_tab[proto], cp); 763 RCU_INIT_POINTER(proto_tab[proto], cp);
@@ -816,11 +811,8 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg,
816 811
817 /* create new dev_rcv_lists for this device */ 812 /* create new dev_rcv_lists for this device */
818 d = kzalloc(sizeof(*d), GFP_KERNEL); 813 d = kzalloc(sizeof(*d), GFP_KERNEL);
819 if (!d) { 814 if (!d)
820 printk(KERN_ERR
821 "can: allocation of receive list failed\n");
822 return NOTIFY_DONE; 815 return NOTIFY_DONE;
823 }
824 BUG_ON(dev->ml_priv); 816 BUG_ON(dev->ml_priv);
825 dev->ml_priv = d; 817 dev->ml_priv = d;
826 818
@@ -838,8 +830,8 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg,
838 dev->ml_priv = NULL; 830 dev->ml_priv = NULL;
839 } 831 }
840 } else 832 } else
841 printk(KERN_ERR "can: notifier: receive list not " 833 pr_err("can: notifier: receive list not found for dev "
842 "found for dev %s\n", dev->name); 834 "%s\n", dev->name);
843 835
844 spin_unlock(&can_rcvlists_lock); 836 spin_unlock(&can_rcvlists_lock);
845 837
@@ -927,7 +919,7 @@ static __exit void can_exit(void)
927 /* remove created dev_rcv_lists from still registered CAN devices */ 919 /* remove created dev_rcv_lists from still registered CAN devices */
928 rcu_read_lock(); 920 rcu_read_lock();
929 for_each_netdev_rcu(&init_net, dev) { 921 for_each_netdev_rcu(&init_net, dev) {
930 if (dev->type == ARPHRD_CAN && dev->ml_priv){ 922 if (dev->type == ARPHRD_CAN && dev->ml_priv) {
931 923
932 struct dev_rcv_lists *d = dev->ml_priv; 924 struct dev_rcv_lists *d = dev->ml_priv;
933 925