瀏覽代碼

drm/mgag200: check alloc_apertures() success in mga_vram_init()

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>
Tommi Rantala 12 年之前
父節點
當前提交
0a7fdc59fb
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/gpu/drm/mgag200/mgag200_main.c

+ 2 - 0
drivers/gpu/drm/mgag200/mgag200_main.c

@@ -133,6 +133,8 @@ static int mga_vram_init(struct mga_device *mdev)
 {
 {
 	void __iomem *mem;
 	void __iomem *mem;
 	struct apertures_struct *aper = alloc_apertures(1);
 	struct apertures_struct *aper = alloc_apertures(1);
+	if (!aper)
+		return -ENOMEM;
 
 
 	/* BAR 0 is VRAM */
 	/* BAR 0 is VRAM */
 	mdev->mc.vram_base = pci_resource_start(mdev->dev->pdev, 0);
 	mdev->mc.vram_base = pci_resource_start(mdev->dev->pdev, 0);