[ATM]: When proc_create() fails, do some error handling work and return -ENOMEM.
[deliverable/linux.git] / net / atm / lec.c
index 813a090dcaf4663abc0294e4eaf8aa79d6b99ad6..a2efa7ff41f128a665172bc593eeed557163ac63 100644 (file)
@@ -176,7 +176,7 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev)
 static unsigned char *get_tr_dst(unsigned char *packet, unsigned char *rdesc)
 {
        struct trh_hdr *trh;
-       int riflen, num_rdsc;
+       unsigned int riflen, num_rdsc;
 
        trh = (struct trh_hdr *)packet;
        if (trh->daddr[0] & (uint8_t) 0x80)
@@ -266,6 +266,7 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
        char buf[300];
        int i = 0;
 #endif /* DUMP_PACKETS >0 */
+       DECLARE_MAC_BUF(mac);
 
        pr_debug("lec_start_xmit called\n");
        if (!priv->lecd) {
@@ -367,25 +368,21 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
 #endif
        entry = NULL;
        vcc = lec_arp_resolve(priv, dst, is_rdesc, &entry);
-       pr_debug("%s:vcc:%p vcc_flags:%x, entry:%p\n", dev->name,
+       pr_debug("%s:vcc:%p vcc_flags:%lx, entry:%p\n", dev->name,
                vcc, vcc ? vcc->flags : 0, entry);
        if (!vcc || !test_bit(ATM_VF_READY, &vcc->flags)) {
                if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) {
                        pr_debug("%s:lec_start_xmit: queuing packet, ",
                                dev->name);
-                       pr_debug("MAC address 0x%02x:%02x:%02x:%02x:%02x:%02x\n",
-                               lec_h->h_dest[0], lec_h->h_dest[1],
-                               lec_h->h_dest[2], lec_h->h_dest[3],
-                               lec_h->h_dest[4], lec_h->h_dest[5]);
+                       pr_debug("MAC address %s\n",
+                                print_mac(mac, lec_h->h_dest));
                        skb_queue_tail(&entry->tx_wait, skb);
                } else {
                        pr_debug
                            ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ",
                             dev->name);
-                       pr_debug("MAC address 0x%02x:%02x:%02x:%02x:%02x:%02x\n",
-                               lec_h->h_dest[0], lec_h->h_dest[1],
-                               lec_h->h_dest[2], lec_h->h_dest[3],
-                               lec_h->h_dest[4], lec_h->h_dest[5]);
+                       pr_debug("MAC address %s\n",
+                                print_mac(mac, lec_h->h_dest));
                        priv->stats.tx_dropped++;
                        dev_kfree_skb(skb);
                }
@@ -397,9 +394,8 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
                pr_debug("lec.c: emptying tx queue, ");
-               pr_debug("MAC address 0x%02x:%02x:%02x:%02x:%02x:%02x\n",
-                       lec_h->h_dest[0], lec_h->h_dest[1], lec_h->h_dest[2],
-                       lec_h->h_dest[3], lec_h->h_dest[4], lec_h->h_dest[5]);
+               pr_debug("MAC address %s\n",
+                        print_mac(mac, lec_h->h_dest));
                lec_send(vcc, skb2, priv);
        }
 
@@ -453,6 +449,7 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
        struct lec_arp_table *entry;
        int i;
        char *tmp;              /* FIXME */
+       DECLARE_MAC_BUF(mac);
 
        atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
        mesg = (struct atmlec_msg *)skb->data;
@@ -539,13 +536,9 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
                        struct net_bridge_fdb_entry *f;
 
                        pr_debug
-                           ("%s: bridge zeppelin asks about 0x%02x:%02x:%02x:%02x:%02x:%02x\n",
-                            dev->name, mesg->content.proxy.mac_addr[0],
-                            mesg->content.proxy.mac_addr[1],
-                            mesg->content.proxy.mac_addr[2],
-                            mesg->content.proxy.mac_addr[3],
-                            mesg->content.proxy.mac_addr[4],
-                            mesg->content.proxy.mac_addr[5]);
+                           ("%s: bridge zeppelin asks about %s\n",
+                            dev->name,
+                            print_mac(mac, mesg->content.proxy.mac_addr));
 
                        if (br_fdb_get_hook == NULL || dev->br_port == NULL)
                                break;
@@ -1256,9 +1249,11 @@ static int __init lane_module_init(void)
 #ifdef CONFIG_PROC_FS
        struct proc_dir_entry *p;
 
-       p = create_proc_entry("lec", S_IRUGO, atm_proc_root);
-       if (p)
-               p->proc_fops = &lec_seq_fops;
+       p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops);
+       if (!p) {
+               printk(KERN_ERR "Unable to initialize /proc/net/atm/lec\n");
+               return -ENOMEM;
+       }
 #endif
 
        register_atm_ioctl(&lane_ioctl_ops);
@@ -1796,9 +1791,8 @@ static struct lec_arp_table *make_entry(struct lec_priv *priv,
        }
        memcpy(to_return->mac_addr, mac_addr, ETH_ALEN);
        INIT_HLIST_NODE(&to_return->next);
-       init_timer(&to_return->timer);
-       to_return->timer.function = lec_arp_expire_arp;
-       to_return->timer.data = (unsigned long)to_return;
+       setup_timer(&to_return->timer, lec_arp_expire_arp,
+                       (unsigned long)to_return);
        to_return->last_used = jiffies;
        to_return->priv = priv;
        skb_queue_head_init(&to_return->tx_wait);
This page took 0.037473 seconds and 5 git commands to generate.