drm/nouveau: check for error when allocating/mapping dummy page
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
415e6186f1
commit
bd6aaea893
1 changed files with 11 additions and 1 deletions
|
@ -214,6 +214,7 @@ int
|
||||||
nouveau_sgdma_init(struct drm_device *dev)
|
nouveau_sgdma_init(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct drm_nouveau_private *dev_priv = dev->dev_private;
|
struct drm_nouveau_private *dev_priv = dev->dev_private;
|
||||||
|
struct pci_dev *pdev = dev->pdev;
|
||||||
struct nouveau_gpuobj *gpuobj = NULL;
|
struct nouveau_gpuobj *gpuobj = NULL;
|
||||||
uint32_t aper_size, obj_size;
|
uint32_t aper_size, obj_size;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
@ -239,10 +240,19 @@ nouveau_sgdma_init(struct drm_device *dev)
|
||||||
|
|
||||||
dev_priv->gart_info.sg_dummy_page =
|
dev_priv->gart_info.sg_dummy_page =
|
||||||
alloc_page(GFP_KERNEL|__GFP_DMA32);
|
alloc_page(GFP_KERNEL|__GFP_DMA32);
|
||||||
|
if (!dev_priv->gart_info.sg_dummy_page) {
|
||||||
|
nouveau_gpuobj_del(dev, &gpuobj);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
set_bit(PG_locked, &dev_priv->gart_info.sg_dummy_page->flags);
|
set_bit(PG_locked, &dev_priv->gart_info.sg_dummy_page->flags);
|
||||||
dev_priv->gart_info.sg_dummy_bus =
|
dev_priv->gart_info.sg_dummy_bus =
|
||||||
pci_map_page(dev->pdev, dev_priv->gart_info.sg_dummy_page, 0,
|
pci_map_page(pdev, dev_priv->gart_info.sg_dummy_page, 0,
|
||||||
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
|
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
|
||||||
|
if (pci_dma_mapping_error(pdev, dev_priv->gart_info.sg_dummy_bus)) {
|
||||||
|
nouveau_gpuobj_del(dev, &gpuobj);
|
||||||
|
return -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
if (dev_priv->card_type < NV_50) {
|
if (dev_priv->card_type < NV_50) {
|
||||||
/* Maybe use NV_DMA_TARGET_AGP for PCIE? NVIDIA do this, and
|
/* Maybe use NV_DMA_TARGET_AGP for PCIE? NVIDIA do this, and
|
||||||
|
|
Loading…
Reference in a new issue