Commit f30a746b authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Greg Kroah-Hartman

staging: sm7xxfb: reserve PCI resource

before starting to access any address inside the PCI region we should
reserve the resource and release the resource when the module exits.
Signed-off-by: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 63b8ebe4
...@@ -776,6 +776,12 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, ...@@ -776,6 +776,12 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
if (err) if (err)
return err; return err;
err = pci_request_region(pdev, 0, "sm7xxfb");
if (err < 0) {
dev_err(&pdev->dev, "cannot reserve framebuffer region\n");
goto failed_regions;
}
sprintf(smtcfb_fix.id, "sm%Xfb", ent->device); sprintf(smtcfb_fix.id, "sm%Xfb", ent->device);
sfb = smtc_alloc_fb_info(pdev); sfb = smtc_alloc_fb_info(pdev);
...@@ -905,6 +911,9 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, ...@@ -905,6 +911,9 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
smtc_free_fb_info(sfb); smtc_free_fb_info(sfb);
failed_free: failed_free:
pci_release_region(pdev, 0);
failed_regions:
pci_disable_device(pdev); pci_disable_device(pdev);
return err; return err;
...@@ -933,6 +942,7 @@ static void smtcfb_pci_remove(struct pci_dev *pdev) ...@@ -933,6 +942,7 @@ static void smtcfb_pci_remove(struct pci_dev *pdev)
smtc_unmap_mmio(sfb); smtc_unmap_mmio(sfb);
unregister_framebuffer(&sfb->fb); unregister_framebuffer(&sfb->fb);
smtc_free_fb_info(sfb); smtc_free_fb_info(sfb);
pci_release_region(pdev, 0);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
......
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