summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2015-03-28 14:33:40 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-03 13:55:03 +0200
commitf30a746bec5507d9781e876626d4bba7f5ab0c8e (patch)
treec1fc05dd00d7e5def777de938a6c3410b9628579 /drivers/staging
parent63b8ebe44ab6bc812f849818250e49e9157c309c (diff)
downloadop-kernel-dev-f30a746bec5507d9781e876626d4bba7f5ab0c8e.zip
op-kernel-dev-f30a746bec5507d9781e876626d4bba7f5ab0c8e.tar.gz
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: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/sm7xxfb/sm7xxfb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c
index 5b3e614..149286e 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -776,6 +776,12 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
if (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);
sfb = smtc_alloc_fb_info(pdev);
@@ -905,6 +911,9 @@ failed_fb:
smtc_free_fb_info(sfb);
failed_free:
+ pci_release_region(pdev, 0);
+
+failed_regions:
pci_disable_device(pdev);
return err;
@@ -933,6 +942,7 @@ static void smtcfb_pci_remove(struct pci_dev *pdev)
smtc_unmap_mmio(sfb);
unregister_framebuffer(&sfb->fb);
smtc_free_fb_info(sfb);
+ pci_release_region(pdev, 0);
}
#ifdef CONFIG_PM
OpenPOWER on IntegriCloud