Merge "dsp: ion: unmap DMA buffer after kernel ion map failure"

Цей коміт міститься в:
qctecmdr
2019-07-04 05:58:39 -07:00
зафіксовано Gerrit - the friendly Code Review server
джерело 95514749d7 ab07f12b3a
коміт 1534fa3eea
2 змінених файлів з 7 додано та 9 видалено

Переглянути файл

@@ -316,6 +316,7 @@ static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
if (rc) {
pr_err("%s: ION Get Physical for AUDIO failed, rc = %d\n",
__func__, rc);
dma_buf_put(dma_buf);
goto err;
}
@@ -323,6 +324,7 @@ static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
if (IS_ERR_OR_NULL(*vaddr)) {
pr_err("%s: ION memory mapping for AUDIO failed\n", __func__);
rc = -ENOMEM;
msm_audio_dma_buf_unmap(dma_buf);
goto err;
}
@@ -384,17 +386,13 @@ int msm_audio_ion_alloc(struct dma_buf **dma_buf, size_t bufsz,
rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, vaddr);
if (rc) {
pr_err("%s: failed to map ION buf, rc = %d\n", __func__, rc);
goto err_dma_buf;
goto err;
}
pr_debug("%s: mapped address = %pK, size=%zd\n", __func__,
*vaddr, bufsz);
memset(*vaddr, 0, bufsz);
return rc;
err_dma_buf:
dma_buf_put(*dma_buf);
err:
return rc;
}
@@ -488,7 +486,7 @@ int msm_audio_ion_import(struct dma_buf **dma_buf, int fd,
rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, vaddr);
if (rc) {
pr_err("%s: failed to map ION buf, rc = %d\n", __func__, rc);
goto err_ion_flag;
goto err;
}
pr_debug("%s: mapped address = %pK, size=%zd\n", __func__,
*vaddr, bufsz);

Переглянути файл

@@ -547,6 +547,7 @@ static int msm_audio_ion_map_buf(void *handle, dma_addr_t *paddr,
if (rc) {
pr_err("%s: ION Get Physical for AUDIO failed, rc = %d\n",
__func__, rc);
dma_buf_put(dma_buf);
goto err;
}
@@ -554,6 +555,7 @@ static int msm_audio_ion_map_buf(void *handle, dma_addr_t *paddr,
if (IS_ERR_OR_NULL(*vaddr)) {
pr_err("%s: ION memory mapping for AUDIO failed\n", __func__);
rc = -ENOMEM;
msm_audio_dma_buf_unmap(dma_buf);
goto err;
}
@@ -624,7 +626,6 @@ int msm_audio_ion_alloc(void **handle, size_t bufsz,
if (rc) {
pr_err("%s: failed to map ION buf, rc = %d\n", __func__,
rc);
dma_buf_put((struct dma_buf*) *handle);
}
} else {
rc = msm_audio_dma_buf_map(*handle, *vaddr, paddr,
@@ -641,7 +642,6 @@ int msm_audio_ion_alloc(void **handle, size_t bufsz,
memset(*vaddr, 0, bufsz);
return rc;
err:
return rc;
}
@@ -699,7 +699,7 @@ int msm_audio_ion_import(void **handle, int fd,
rc = msm_audio_ion_map_buf(*handle, paddr, plen, vaddr);
if (rc) {
pr_err("%s: failed to map ION buf, rc = %d\n", __func__, rc);
goto err_ion_flag;
goto err;
}
pr_debug("%s: mapped address = %pK, size=%zd\n", __func__,
*vaddr, bufsz);