rk: ion: return appropriate value if iommu map fail
authorCMY <cmy@rock-chips.com>
Thu, 14 Aug 2014 02:49:15 +0000 (10:49 +0800)
committerCMY <cmy@rock-chips.com>
Thu, 14 Aug 2014 02:49:26 +0000 (10:49 +0800)
drivers/staging/android/ion/ion.c
drivers/staging/android/ion/ion_cma_heap.c
drivers/staging/android/ion/ion_system_heap.c

index 95ae1c043c5bd42604ced27836db4575c91198b7..58d5d96a1360e7221c31fc5e9ec0c040c24886bb 100755 (executable)
@@ -817,8 +817,8 @@ int ion_map_iommu(struct device *iommu_dev, struct ion_client *client,
        if (!iommu_map) {
                pr_debug("%s: create new map for buffer(%p)\n", __func__, buffer);
                iommu_map = __ion_iommu_map(buffer, iommu_dev, iova);
-               if (!IS_ERR_OR_NULL(iommu_map))
-                       ret = -ENOMEM;
+               if (IS_ERR(iommu_map))
+                       ret = PTR_ERR(iommu_map);
        } else {
                pr_debug("%s: buffer(%p) already mapped\n", __func__, buffer);
                if (iommu_map->mapped_size != buffer->size) {
index fc493631be397bb8a5dfb03674019b7a818f8da8..508c44e2627227a51b7a29eb6c07fe4246f787f0 100755 (executable)
@@ -207,9 +207,9 @@ static int ion_cma_map_iommu(struct ion_buffer *buffer,
        data->iova_addr = rockchip_iovmm_map(iommu_dev, info->table->sgl, 0, iova_length);
        pr_debug("%s: map %x -> %lx\n", __func__, info->table->sgl->dma_address,
                data->iova_addr);
-       if (IS_ERR_OR_NULL(data->iova_addr)) {
+       if (IS_ERR_VALUE(data->iova_addr)) {
                pr_err("%s: rockchip_iovmm_map() failed: %lx\n", __func__, data->iova_addr);
-               ret = -ENOMEM;
+               ret = data->iova_addr;
                goto out;
        }
 
index 95da2a6aed5a96489ab8406a530e77f0371ceb74..4593046b9a6f7867241b79891498dfecc015e623 100755 (executable)
@@ -262,9 +262,9 @@ static int ion_system_map_iommu(struct ion_buffer *buffer,
 
        data->iova_addr = rockchip_iovmm_map(iommu_dev, table->sgl, 0, iova_length);
        pr_debug("%s: map %x -> %lx\n", __func__, table->sgl->dma_address, data->iova_addr);
-       if (IS_ERR_OR_NULL(data->iova_addr)) {
+       if (IS_ERR_VALUE(data->iova_addr)) {
                pr_err("%s: rockchip_iovmm_map() failed: %lx\n", __func__, data->iova_addr);
-               ret = -ENOMEM;
+               ret = data->iova_addr;
                goto out;
        }