usb: u_qdss: Add proper error handling for map failure of iova

dma_map_resource() API returns DMA_MAPPING_ERROR i.e -1 upon error.
The current code checks against NULL which makes it think that the
API returned successfully. The incorrect IOVA further results into
SMMU fault. To fix this, add proper error handling for mapping
failure of iova.

Change-Id: I080049029ce01be13c603a1d709e37189a09484e
Signed-off-by: Rohith Kollalsi <quic_rkollals@quicinc.com>
This commit is contained in:
Rohith Kollalsi 2022-02-24 12:19:38 +05:30 • committed by Gerrit - the friendly Code Review server
commit 7acc156970

View file

@ -73,7 +73,7 @@ int set_qdss_data_connection(struct f_qdss *qdss, int enable)
bam_info.qdss_bam_iova = dma_map_resource(dev->parent,
bam_info.qdss_bam_phys, bam_info.qdss_bam_size,
DMA_BIDIRECTIONAL, 0);
if (!bam_info.qdss_bam_iova) {
if (dma_mapping_error(dev, bam_info.qdss_bam_iova)) {
pr_err("dma_map_resource failed\n");
return -ENOMEM;
}