aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-12-17 02:03:44 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2018-12-17 04:47:17 -0500
commitc27889ca3bb8bdc936bd0477125f0f6ff4c42df3 (patch)
treece86098416b69560485434f2ba6b604ee1179784 /drivers/gpu/drm
parent705c8160ce88825d2491aa55fa9da4fa79204c10 (diff)
drm/ati_pcigart: Fix error code in drm_ati_pcigart_init()
The drm_ati_pcigart_init() function was originally suppose to return one on success and zero on failure, but these days it returns a mix of zero, one and -ENOMEM on failure. This patch cleans it up and modifies the caller so now the function returns zero on success and negative error codes on failure. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20181217070344.GC12159@kadam
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/ati_pcigart.c7
-rw-r--r--drivers/gpu/drm/r128/r128_cce.c5
2 files changed, 7 insertions, 5 deletions
diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c
index 6c4d4b6eba80..2362f07fe1fc 100644
--- a/drivers/gpu/drm/ati_pcigart.c
+++ b/drivers/gpu/drm/ati_pcigart.c
@@ -103,7 +103,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
103 unsigned long pages; 103 unsigned long pages;
104 u32 *pci_gart = NULL, page_base, gart_idx; 104 u32 *pci_gart = NULL, page_base, gart_idx;
105 dma_addr_t bus_address = 0; 105 dma_addr_t bus_address = 0;
106 int i, j, ret = 0; 106 int i, j, ret = -ENOMEM;
107 int max_ati_pages, max_real_pages; 107 int max_ati_pages, max_real_pages;
108 108
109 if (!entry) { 109 if (!entry) {
@@ -117,7 +117,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
117 if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) { 117 if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) {
118 DRM_ERROR("fail to set dma mask to 0x%Lx\n", 118 DRM_ERROR("fail to set dma mask to 0x%Lx\n",
119 (unsigned long long)gart_info->table_mask); 119 (unsigned long long)gart_info->table_mask);
120 ret = 1; 120 ret = -EFAULT;
121 goto done; 121 goto done;
122 } 122 }
123 123
@@ -160,6 +160,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
160 drm_ati_pcigart_cleanup(dev, gart_info); 160 drm_ati_pcigart_cleanup(dev, gart_info);
161 address = NULL; 161 address = NULL;
162 bus_address = 0; 162 bus_address = 0;
163 ret = -ENOMEM;
163 goto done; 164 goto done;
164 } 165 }
165 page_base = (u32) entry->busaddr[i]; 166 page_base = (u32) entry->busaddr[i];
@@ -188,7 +189,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
188 page_base += ATI_PCIGART_PAGE_SIZE; 189 page_base += ATI_PCIGART_PAGE_SIZE;
189 } 190 }
190 } 191 }
191 ret = 1; 192 ret = 0;
192 193
193#if defined(__i386__) || defined(__x86_64__) 194#if defined(__i386__) || defined(__x86_64__)
194 wbinvd(); 195 wbinvd();
diff --git a/drivers/gpu/drm/r128/r128_cce.c b/drivers/gpu/drm/r128/r128_cce.c
index c9890afe69d6..b91af1bf531b 100644
--- a/drivers/gpu/drm/r128/r128_cce.c
+++ b/drivers/gpu/drm/r128/r128_cce.c
@@ -560,11 +560,12 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init)
560 dev_priv->gart_info.addr = NULL; 560 dev_priv->gart_info.addr = NULL;
561 dev_priv->gart_info.bus_addr = 0; 561 dev_priv->gart_info.bus_addr = 0;
562 dev_priv->gart_info.gart_reg_if = DRM_ATI_GART_PCI; 562 dev_priv->gart_info.gart_reg_if = DRM_ATI_GART_PCI;
563 if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) { 563 rc = drm_ati_pcigart_init(dev, &dev_priv->gart_info);
564 if (rc) {
564 DRM_ERROR("failed to init PCI GART!\n"); 565 DRM_ERROR("failed to init PCI GART!\n");
565 dev->dev_private = (void *)dev_priv; 566 dev->dev_private = (void *)dev_priv;
566 r128_do_cleanup_cce(dev); 567 r128_do_cleanup_cce(dev);
567 return -ENOMEM; 568 return rc;
568 } 569 }
569 R128_WRITE(R128_PCI_GART_PAGE, dev_priv->gart_info.bus_addr); 570 R128_WRITE(R128_PCI_GART_PAGE, dev_priv->gart_info.bus_addr);
570#if IS_ENABLED(CONFIG_AGP) 571#if IS_ENABLED(CONFIG_AGP)