Commit 843f65c6 authored by Mark Allyn's avatar Mark Allyn Committed by Greg Kroah-Hartman

Staging: sep: clean up error checking in probe function

Add pci_disable
Signed-off-by: default avatarMark Allyn <mark.a.allyn@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b0daf59c
...@@ -3437,7 +3437,8 @@ static int __devinit sep_probe(struct pci_dev *pdev, ...@@ -3437,7 +3437,8 @@ static int __devinit sep_probe(struct pci_dev *pdev,
if (sep_dev == NULL) { if (sep_dev == NULL) {
dev_warn(&pdev->dev, dev_warn(&pdev->dev,
"can't kmalloc the sep_device structure\n"); "can't kmalloc the sep_device structure\n");
return -ENOMEM; error = -ENOMEM;
goto end_function_disable_device;
} }
/* /*
...@@ -3448,7 +3449,7 @@ static int __devinit sep_probe(struct pci_dev *pdev, ...@@ -3448,7 +3449,7 @@ static int __devinit sep_probe(struct pci_dev *pdev,
*/ */
sep = sep_dev; sep = sep_dev;
sep->pdev = pdev; sep->pdev = pci_dev_get(pdev);
init_waitqueue_head(&sep->event); init_waitqueue_head(&sep->event);
init_waitqueue_head(&sep->event_request_daemon); init_waitqueue_head(&sep->event_request_daemon);
...@@ -3466,23 +3467,23 @@ static int __devinit sep_probe(struct pci_dev *pdev, ...@@ -3466,23 +3467,23 @@ static int __devinit sep_probe(struct pci_dev *pdev,
sep->reg_physical_addr = pci_resource_start(sep->pdev, 0); sep->reg_physical_addr = pci_resource_start(sep->pdev, 0);
if (!sep->reg_physical_addr) { if (!sep->reg_physical_addr) {
dev_warn(&sep->pdev->dev, "Error getting register start\n"); dev_warn(&sep->pdev->dev, "Error getting register start\n");
pci_dev_put(sep->pdev); error = -ENODEV;
return -ENODEV; goto end_function_free_sep_dev;
} }
sep->reg_physical_end = pci_resource_end(sep->pdev, 0); sep->reg_physical_end = pci_resource_end(sep->pdev, 0);
if (!sep->reg_physical_end) { if (!sep->reg_physical_end) {
dev_warn(&sep->pdev->dev, "Error getting register end\n"); dev_warn(&sep->pdev->dev, "Error getting register end\n");
pci_dev_put(sep->pdev); error = -ENODEV;
return -ENODEV; goto end_function_free_sep_dev;
} }
sep->reg_addr = ioremap_nocache(sep->reg_physical_addr, sep->reg_addr = ioremap_nocache(sep->reg_physical_addr,
(size_t)(sep->reg_physical_end - sep->reg_physical_addr + 1)); (size_t)(sep->reg_physical_end - sep->reg_physical_addr + 1));
if (!sep->reg_addr) { if (!sep->reg_addr) {
dev_warn(&sep->pdev->dev, "Error getting register virtual\n"); dev_warn(&sep->pdev->dev, "Error getting register virtual\n");
pci_dev_put(sep->pdev); error = -ENODEV;
return -ENODEV; goto end_function_free_sep_dev;
} }
dev_dbg(&sep->pdev->dev, dev_dbg(&sep->pdev->dev,
...@@ -3573,9 +3574,15 @@ static int __devinit sep_probe(struct pci_dev *pdev, ...@@ -3573,9 +3574,15 @@ static int __devinit sep_probe(struct pci_dev *pdev,
end_function_error: end_function_error:
iounmap(sep->reg_addr); iounmap(sep->reg_addr);
end_function_free_sep_dev:
pci_dev_put(sep_dev->pdev);
kfree(sep_dev); kfree(sep_dev);
sep_dev = NULL; sep_dev = NULL;
end_function_disable_device:
pci_disable_device(pdev);
end_function: end_function:
return error; return error;
} }
......
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