drm/radeon: Fix pci_map_page() error checking
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 10 Aug 2010 04:48:58 +0000 (14:48 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 11 Aug 2010 23:38:29 +0000 (09:38 +1000)
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>
drivers/gpu/drm/ati_pcigart.c
drivers/gpu/drm/radeon/r600_cp.c
drivers/gpu/drm/radeon/radeon_device.c

index 17be051b7aa3109c4aef78b320823da2eecb5fc8..1c3649242208a5f38f8bda017799f4519a14e43d 100644 (file)
@@ -152,7 +152,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
                /* we need to support large memory configurations */
                entry->busaddr[i] = pci_map_page(dev->pdev, entry->pagelist[i],
                                                 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
-               if (entry->busaddr[i] == 0) {
+               if (pci_dma_mapping_error(dev->pdev, entry->busaddr[i])) {
                        DRM_ERROR("unable to map PCIGART pages!\n");
                        drm_ati_pcigart_cleanup(dev, gart_info);
                        address = NULL;
index 68e6f434930908a8ed4c1a48f702b904206f5c64..4f4cd8b286d504a88043b1893d60db19ba20a421 100644 (file)
@@ -200,7 +200,7 @@ int r600_page_table_init(struct drm_device *dev)
                                                 entry->pagelist[i], 0,
                                                 PAGE_SIZE,
                                                 PCI_DMA_BIDIRECTIONAL);
-               if (entry->busaddr[i] == 0) {
+               if (pci_dma_mapping_error(dev->pdev, entry->busaddr[i])) {
                        DRM_ERROR("unable to map PCIGART pages!\n");
                        r600_page_table_cleanup(dev, gart_info);
                        goto done;
index a64811a94519a1ce5bd245d7f2c864e0d68ecf3d..4f7a170d15663a3f3030f2e02e517718e6998968 100644 (file)
@@ -347,7 +347,8 @@ int radeon_dummy_page_init(struct radeon_device *rdev)
                return -ENOMEM;
        rdev->dummy_page.addr = pci_map_page(rdev->pdev, rdev->dummy_page.page,
                                        0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
-       if (!rdev->dummy_page.addr) {
+       if (pci_dma_mapping_error(rdev->pdev, rdev->dummy_page.addr)) {
+               dev_err(&rdev->pdev->dev, "Failed to DMA MAP the dummy page\n");
                __free_page(rdev->dummy_page.page);
                rdev->dummy_page.page = NULL;
                return -ENOMEM;