Commit 15b8e191 authored by roel kluin's avatar roel kluin Committed by David S. Miller

pasemi_mac: mac_to_intf() error not noticed

mac_to_intf() can return -1 when no device or function is found, but when
mac->dma_if is unsigned. The error wasn't noticed.
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Acked-by: default avatarOlof Johansson <olof@lixom.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 683703a2
...@@ -1733,7 +1733,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1733,7 +1733,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
struct net_device *dev; struct net_device *dev;
struct pasemi_mac *mac; struct pasemi_mac *mac;
int err; int err, ret;
err = pci_enable_device(pdev); err = pci_enable_device(pdev);
if (err) if (err)
...@@ -1791,12 +1791,13 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1791,12 +1791,13 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
memcpy(dev->dev_addr, mac->mac_addr, sizeof(mac->mac_addr)); memcpy(dev->dev_addr, mac->mac_addr, sizeof(mac->mac_addr));
mac->dma_if = mac_to_intf(mac); ret = mac_to_intf(mac);
if (mac->dma_if < 0) { if (ret < 0) {
dev_err(&mac->pdev->dev, "Can't map DMA interface\n"); dev_err(&mac->pdev->dev, "Can't map DMA interface\n");
err = -ENODEV; err = -ENODEV;
goto out; goto out;
} }
mac->dma_if = ret;
switch (pdev->device) { switch (pdev->device) {
case 0xa005: case 0xa005:
......
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