diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-08-10 00:48:58 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-08-11 19:38:29 -0400 |
commit | a30f6fb7ce86275af16c7a00dc1b1e46cbb99692 (patch) | |
tree | 2097765b7dd20577bca52781d7f216c9d1829244 /drivers/gpu | |
parent | 1a72d65d6291ec248cbc5f05df2487edd714aba6 (diff) |
drm/radeon: Fix pci_map_page() error checking
0 is a valid DMA address from pci_map_page(), use pci_dma_mapping_error()
instead to check for errors
[airlied: fix warning + two other places with errors.]
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/ati_pcigart.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r600_cp.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 3 |
3 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c index 17be051b7aa3..1c3649242208 100644 --- a/drivers/gpu/drm/ati_pcigart.c +++ b/drivers/gpu/drm/ati_pcigart.c | |||
@@ -152,7 +152,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga | |||
152 | /* we need to support large memory configurations */ | 152 | /* we need to support large memory configurations */ |
153 | entry->busaddr[i] = pci_map_page(dev->pdev, entry->pagelist[i], | 153 | entry->busaddr[i] = pci_map_page(dev->pdev, entry->pagelist[i], |
154 | 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); | 154 | 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
155 | if (entry->busaddr[i] == 0) { | 155 | if (pci_dma_mapping_error(dev->pdev, entry->busaddr[i])) { |
156 | DRM_ERROR("unable to map PCIGART pages!\n"); | 156 | DRM_ERROR("unable to map PCIGART pages!\n"); |
157 | drm_ati_pcigart_cleanup(dev, gart_info); | 157 | drm_ati_pcigart_cleanup(dev, gart_info); |
158 | address = NULL; | 158 | address = NULL; |
diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c index 68e6f4349309..4f4cd8b286d5 100644 --- a/drivers/gpu/drm/radeon/r600_cp.c +++ b/drivers/gpu/drm/radeon/r600_cp.c | |||
@@ -200,7 +200,7 @@ int r600_page_table_init(struct drm_device *dev) | |||
200 | entry->pagelist[i], 0, | 200 | entry->pagelist[i], 0, |
201 | PAGE_SIZE, | 201 | PAGE_SIZE, |
202 | PCI_DMA_BIDIRECTIONAL); | 202 | PCI_DMA_BIDIRECTIONAL); |
203 | if (entry->busaddr[i] == 0) { | 203 | if (pci_dma_mapping_error(dev->pdev, entry->busaddr[i])) { |
204 | DRM_ERROR("unable to map PCIGART pages!\n"); | 204 | DRM_ERROR("unable to map PCIGART pages!\n"); |
205 | r600_page_table_cleanup(dev, gart_info); | 205 | r600_page_table_cleanup(dev, gart_info); |
206 | goto done; | 206 | goto done; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index a64811a94519..4f7a170d1566 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -347,7 +347,8 @@ int radeon_dummy_page_init(struct radeon_device *rdev) | |||
347 | return -ENOMEM; | 347 | return -ENOMEM; |
348 | rdev->dummy_page.addr = pci_map_page(rdev->pdev, rdev->dummy_page.page, | 348 | rdev->dummy_page.addr = pci_map_page(rdev->pdev, rdev->dummy_page.page, |
349 | 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); | 349 | 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
350 | if (!rdev->dummy_page.addr) { | 350 | if (pci_dma_mapping_error(rdev->pdev, rdev->dummy_page.addr)) { |
351 | dev_err(&rdev->pdev->dev, "Failed to DMA MAP the dummy page\n"); | ||
351 | __free_page(rdev->dummy_page.page); | 352 | __free_page(rdev->dummy_page.page); |
352 | rdev->dummy_page.page = NULL; | 353 | rdev->dummy_page.page = NULL; |
353 | return -ENOMEM; | 354 | return -ENOMEM; |