summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorTommi Rantala <tt.rantala@gmail.com>2012-11-09 09:19:35 +0000
committerDave Airlie <airlied@redhat.com>2012-11-20 16:06:23 +1000
commitbfb82ff0ee1dd0d1eed45ee25aa601f4ea5c54ac (patch)
tree9501354b485d137f8c58b4fb27f88dea9c3939f9 /drivers/gpu/drm
parent91926741ecd28dc246875a39a908c2f6aadb2542 (diff)
downloadtalos-obmc-linux-bfb82ff0ee1dd0d1eed45ee25aa601f4ea5c54ac.tar.gz
talos-obmc-linux-bfb82ff0ee1dd0d1eed45ee25aa601f4ea5c54ac.zip
drm/cirrus: check alloc_apertures() success in cirrus_kick_out_firmware_fb()
Check for alloc_apertures() memory allocation failure, and propagate an error code in case the allocation failed. Signed-off-by: Tommi Rantala <tt.rantala@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_drv.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c
index 101e423c8991..dcd1a8c029eb 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -35,12 +35,15 @@ static DEFINE_PCI_DEVICE_TABLE(pciidlist) = {
};
-static void cirrus_kick_out_firmware_fb(struct pci_dev *pdev)
+static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev)
{
struct apertures_struct *ap;
bool primary = false;
ap = alloc_apertures(1);
+ if (!ap)
+ return -ENOMEM;
+
ap->ranges[0].base = pci_resource_start(pdev, 0);
ap->ranges[0].size = pci_resource_len(pdev, 0);
@@ -49,12 +52,18 @@ static void cirrus_kick_out_firmware_fb(struct pci_dev *pdev)
#endif
remove_conflicting_framebuffers(ap, "cirrusdrmfb", primary);
kfree(ap);
+
+ return 0;
}
static int __devinit
cirrus_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- cirrus_kick_out_firmware_fb(pdev);
+ int ret;
+
+ ret = cirrus_kick_out_firmware_fb(pdev);
+ if (ret)
+ return ret;
return drm_get_pci_dev(pdev, ent, &driver);
}
OpenPOWER on IntegriCloud