dma-heap: qcom: correct msm_dma_map_sgtable return value
__alloc_and_insert_iova_range return -ENOMEM when there is no suitable size, where dma_buf_map_attachment return -EINVAL which is not accurate info. Call trace: alloc_iova+0x2cc/0x318 alloc_iova_fast+0x190/0x2c4 iommu_dma_alloc_iova+0xc0/0x180 iommu_dma_map_sg+0x1cc/0x3a0 dma_map_sg_attrs+0x44/0xbc msm_dma_map_sg_attrs+0x398/0x6a4 [msm_dma_iommu_mapping] qcom_sg_map_dma_buf+0xe4/0x14c [qcom_dma_heaps] dma_buf_map_attachment+0xcc/0x1d8 fastrpc_mmap_create+0x3a8/0x938 [frpc_adsprpc] fastrpc_internal_mmap+0x100/0x268 [frpc_adsprpc] fastrpc_device_ioctl+0x620/0x2078 [frpc_adsprpc] __arm64_sys_ioctl+0xa8/0xe4 invoke_syscall+0x58/0x11c el0_svc_common+0xb4/0xf4 do_el0_svc+0x2c/0xb0 el0_svc+0x2c/0xa4 el0t_64_sync_handler+0x68/0xb4 el0t_64_sync+0x1a0/0x1a4 change this to follow upstream usage in kernel/dma/mapping.c dma_map_sgtable. Change-Id: I5cec3005a8759de820705c268fef18addb2a8899 Signed-off-by: Kassey Li <quic_yingangl@quicinc.com>
This commit is contained in:
parent
448c4d6649
commit
5f9d49eb40
@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2015-2016, 2018, 2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_MSM_DMA_IOMMU_MAPPING_H
|
||||
@ -66,7 +67,9 @@ static inline int msm_dma_map_sgtable(struct device *dev, struct sg_table *sgt,
|
||||
int nents;
|
||||
|
||||
nents = msm_dma_map_sg_attrs(dev, sgt->sgl, sgt->orig_nents, dir, dma_buf, attrs);
|
||||
if (nents <= 0)
|
||||
if (nents < 0)
|
||||
return nents;
|
||||
else if (unlikely(nents == 0))
|
||||
return -EINVAL;
|
||||
|
||||
sgt->nents = nents;
|
||||
|
Loading…
Reference in New Issue
Block a user