rk: ion: check the iommu map's result
authorCMY <cmy@rock-chips.com>
Thu, 14 Aug 2014 01:03:21 +0000 (09:03 +0800)
committerCMY <cmy@rock-chips.com>
Thu, 14 Aug 2014 01:03:21 +0000 (09:03 +0800)
drivers/staging/android/ion/ion.c
drivers/staging/android/ion/ion_cma_heap.c
drivers/staging/android/ion/ion_system_heap.c

index 41a537eeea8a0ae06c62d76070d716e34ee9f04e..95ae1c043c5bd42604ced27836db4575c91198b7 100755 (executable)
@@ -817,6 +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;
        } else {
                pr_debug("%s: buffer(%p) already mapped\n", __func__, buffer);
                if (iommu_map->mapped_size != buffer->size) {
index 8e5529262f5dd18fbc6c2c730fe4909dc154a8d1..fc493631be397bb8a5dfb03674019b7a818f8da8 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 (!data->iova_addr || IS_ERR_VALUE(data->iova_addr)) {
+       if (IS_ERR_OR_NULL(data->iova_addr)) {
                pr_err("%s: rockchip_iovmm_map() failed: %lx\n", __func__, data->iova_addr);
-               ret = -EINVAL;
+               ret = -ENOMEM;
                goto out;
        }
 
index a8bd939eec195351020611bec0fab033f83f3bb1..95da2a6aed5a96489ab8406a530e77f0371ceb74 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 (!data->iova_addr || IS_ERR_VALUE(data->iova_addr)) {
+       if (IS_ERR_OR_NULL(data->iova_addr)) {
                pr_err("%s: rockchip_iovmm_map() failed: %lx\n", __func__, data->iova_addr);
-               ret = -EINVAL;
+               ret = -ENOMEM;
                goto out;
        }