aboutsummaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
Diffstat (limited to 'net/can')
-rw-r--r--net/can/af_can.c30
-rw-r--r--net/can/gw.c11
-rw-r--r--net/can/raw.c5
3 files changed, 18 insertions, 28 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
diff --git a/net/can/gw.c b/net/can/gw.c
index 2d117dc5ebea..3ee690e8c7d3 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -466,7 +466,7 @@ static int cgw_notifier(struct notifier_block *nb,
466 if (gwj->src.dev == dev || gwj->dst.dev == dev) { 466 if (gwj->src.dev == dev || gwj->dst.dev == dev) {
467 hlist_del(&gwj->list); 467 hlist_del(&gwj->list);
468 cgw_unregister_filter(gwj); 468 cgw_unregister_filter(gwj);
469 kfree(gwj); 469 kmem_cache_free(cgw_cache, gwj);
470 } 470 }
471 } 471 }
472 } 472 }
@@ -778,8 +778,7 @@ static int cgw_parse_attr(struct nlmsghdr *nlh, struct cf_mod *mod,
778 return 0; 778 return 0;
779} 779}
780 780
781static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh, 781static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh)
782 void *arg)
783{ 782{
784 struct rtcanmsg *r; 783 struct rtcanmsg *r;
785 struct cgw_job *gwj; 784 struct cgw_job *gwj;
@@ -864,11 +863,11 @@ static void cgw_remove_all_jobs(void)
864 hlist_for_each_entry_safe(gwj, nx, &cgw_list, list) { 863 hlist_for_each_entry_safe(gwj, nx, &cgw_list, list) {
865 hlist_del(&gwj->list); 864 hlist_del(&gwj->list);
866 cgw_unregister_filter(gwj); 865 cgw_unregister_filter(gwj);
867 kfree(gwj); 866 kmem_cache_free(cgw_cache, gwj);
868 } 867 }
869} 868}
870 869
871static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) 870static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh)
872{ 871{
873 struct cgw_job *gwj = NULL; 872 struct cgw_job *gwj = NULL;
874 struct hlist_node *nx; 873 struct hlist_node *nx;
@@ -920,7 +919,7 @@ static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
920 919
921 hlist_del(&gwj->list); 920 hlist_del(&gwj->list);
922 cgw_unregister_filter(gwj); 921 cgw_unregister_filter(gwj);
923 kfree(gwj); 922 kmem_cache_free(cgw_cache, gwj);
924 err = 0; 923 err = 0;
925 break; 924 break;
926 } 925 }
diff --git a/net/can/raw.c b/net/can/raw.c
index c1764e41ddaf..1085e65f848e 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -711,9 +711,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
711 err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); 711 err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
712 if (err < 0) 712 if (err < 0)
713 goto free_skb; 713 goto free_skb;
714 err = sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags); 714
715 if (err < 0) 715 sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
716 goto free_skb;
717 716
718 skb->dev = dev; 717 skb->dev = dev;
719 skb->sk = sk; 718 skb->sk = sk;