Skip to content

Commit

Permalink
drm/mgag200: check alloc_apertures() success in mga_vram_init()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tommi Rantala authored and Dave Airlie committed Nov 20, 2012
1 parent bfb82ff commit 0a7fdc5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/mgag200/mgag200_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ static int mga_vram_init(struct mga_device *mdev)
{
void __iomem *mem;
struct apertures_struct *aper = alloc_apertures(1);
if (!aper)
return -ENOMEM;

/* BAR 0 is VRAM */
mdev->mc.vram_base = pci_resource_start(mdev->dev->pdev, 0);
Expand Down

0 comments on commit 0a7fdc5

Please sign in to comment.