These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / net / ethernet / intel / e100.c
index 1a450f4..068789e 100644 (file)
@@ -874,7 +874,7 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb,
 {
        struct cb *cb;
        unsigned long flags;
-       int err = 0;
+       int err;
 
        spin_lock_irqsave(&nic->cb_lock, flags);
 
@@ -1770,8 +1770,11 @@ static int e100_xmit_prepare(struct nic *nic, struct cb *cb,
        dma_addr = pci_map_single(nic->pdev,
                                  skb->data, skb->len, PCI_DMA_TODEVICE);
        /* If we can't map the skb, have the upper layer try later */
-       if (pci_dma_mapping_error(nic->pdev, dma_addr))
+       if (pci_dma_mapping_error(nic->pdev, dma_addr)) {
+               dev_kfree_skb_any(skb);
+               skb = NULL;
                return -ENOMEM;
+       }
 
        /*
         * Use the last 4 bytes of the SKB payload packet as the CRC, used for
@@ -2922,9 +2925,7 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        pci_set_master(pdev);
 
-       init_timer(&nic->watchdog);
-       nic->watchdog.function = e100_watchdog;
-       nic->watchdog.data = (unsigned long)nic;
+       setup_timer(&nic->watchdog, e100_watchdog, (unsigned long)nic);
 
        INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task);
 
@@ -2969,6 +2970,11 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                           nic->params.cbs.max * sizeof(struct cb),
                           sizeof(u32),
                           0);
+       if (!nic->cbs_pool) {
+               netif_err(nic, probe, nic->netdev, "Cannot create DMA pool, aborting\n");
+               err = -ENOMEM;
+               goto err_out_pool;
+       }
        netif_info(nic, probe, nic->netdev,
                   "addr 0x%llx, irq %d, MAC addr %pM\n",
                   (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0),
@@ -2976,6 +2982,8 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        return 0;
 
+err_out_pool:
+       unregister_netdev(netdev);
 err_out_free:
        e100_free(nic);
 err_out_iounmap: