Skip to content

Commit 2e6c6a8

Browse files
snitsjoergroedel
authored andcommitted
iommu/amd: Print reason for iommu_map_page failure in map_sg
Since there are multiple possible failures in iommu_map_page it would be useful to know which case is being hit when the error message is printed in map_sg. While here, fix up checkpatch complaint about using function name in a string instead of __func__. Cc: Joerg Roedel <joro@8bytes.org> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent f17b5f0 commit 2e6c6a8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,6 +2562,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
25622562
struct scatterlist *s;
25632563
unsigned long address;
25642564
u64 dma_mask;
2565+
int ret;
25652566

25662567
domain = get_domain(dev);
25672568
if (IS_ERR(domain))
@@ -2584,7 +2585,6 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
25842585

25852586
for (j = 0; j < pages; ++j) {
25862587
unsigned long bus_addr, phys_addr;
2587-
int ret;
25882588

25892589
bus_addr = address + s->dma_address + (j << PAGE_SHIFT);
25902590
phys_addr = (sg_phys(s) & PAGE_MASK) + (j << PAGE_SHIFT);
@@ -2605,8 +2605,8 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
26052605
return nelems;
26062606

26072607
out_unmap:
2608-
pr_err("%s: IOMMU mapping error in map_sg (io-pages: %d)\n",
2609-
dev_name(dev), npages);
2608+
pr_err("%s: IOMMU mapping error in %s (io-pages: %d) reason: %d\n",
2609+
dev_name(dev), __func__, npages, ret);
26102610

26112611
for_each_sg(sglist, s, nelems, i) {
26122612
int j, pages = iommu_num_pages(sg_phys(s), s->length, PAGE_SIZE);

0 commit comments

Comments
 (0)