Skip to content

Commit

Permalink
pasemi_mac: mac_to_intf() error not noticed
Browse files Browse the repository at this point in the history
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: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
roel kluin authored and David S. Miller committed Apr 27, 2009
1 parent 683703a commit 15b8e19
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/net/pasemi_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct net_device *dev;
struct pasemi_mac *mac;
int err;
int err, ret;

err = pci_enable_device(pdev);
if (err)
Expand Down Expand Up @@ -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));

mac->dma_if = mac_to_intf(mac);
if (mac->dma_if < 0) {
ret = mac_to_intf(mac);
if (ret < 0) {
dev_err(&mac->pdev->dev, "Can't map DMA interface\n");
err = -ENODEV;
goto out;
}
mac->dma_if = ret;

switch (pdev->device) {
case 0xa005:
Expand Down

0 comments on commit 15b8e19

Please sign in to comment.