Commit 1fdbbfd5 authored by 蒋家盛's avatar 蒋家盛 Committed by Joerg Roedel
Browse files

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: 1c894225 ("iommu/ipmmu-vmsa: IPMMU device is 40-bit bus master")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: default avatarNikita Yushchenko <nikita.yoush@cogentembedded.com>
Link: https://lore.kernel.org/r/20220106024302.2574180-1-jiasheng@iscas.ac.cn


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 754e0b0e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1006,7 +1006,9 @@ static int ipmmu_probe(struct platform_device *pdev)
	bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
	mmu->features = of_device_get_match_data(&pdev->dev);
	memset(mmu->utlb_ctx, IPMMU_CTX_INVALID, mmu->features->num_utlbs);
	dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
	if (ret)
		return ret;

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