Skip to content

Commit 1fdbbfd

Browse files
JiangJiasjoergroedel
authored andcommitted
iommu/ipmmu-vmsa: Check for error num after setting mask
Because of the possible failure of the dma_supported(), the dma_set_mask_and_coherent() may return error num. Therefore, it should be better to check it and return the error if fails. Fixes: 1c89422 ("iommu/ipmmu-vmsa: IPMMU device is 40-bit bus master") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Link: https://lore.kernel.org/r/20220106024302.2574180-1-jiasheng@iscas.ac.cn Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 754e0b0 commit 1fdbbfd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/iommu/ipmmu-vmsa.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,9 @@ static int ipmmu_probe(struct platform_device *pdev)
10061006
bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
10071007
mmu->features = of_device_get_match_data(&pdev->dev);
10081008
memset(mmu->utlb_ctx, IPMMU_CTX_INVALID, mmu->features->num_utlbs);
1009-
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
1009+
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
1010+
if (ret)
1011+
return ret;
10101012

10111013
/* Map I/O memory and request IRQ. */
10121014
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

0 commit comments

Comments
 (0)