Skip to content

Commit 9a925bc

Browse files
committed
dcp: Warn if DMA mapping fails
Signed-off-by: Hector Martin <[email protected]>
1 parent 613ee7e commit 9a925bc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/gpu/drm/apple/iomfb_template.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ static struct dcp_map_physical_resp
412412
dcpep_cb_map_physical(struct apple_dcp *dcp, struct dcp_map_physical_req *req)
413413
{
414414
int size = ALIGN(req->size, 4096);
415+
dma_addr_t dva;
415416
u32 id;
416417

417418
if (!is_disp_register(dcp, req->paddr, req->paddr + size - 1)) {
@@ -425,11 +426,13 @@ dcpep_cb_map_physical(struct apple_dcp *dcp, struct dcp_map_physical_req *req)
425426
dcp->memdesc[id].size = size;
426427
dcp->memdesc[id].reg = req->paddr;
427428

429+
dva = dma_map_resource(dcp->dev, req->paddr, size, DMA_BIDIRECTIONAL, 0);
430+
WARN_ON(dva == DMA_MAPPING_ERROR);
431+
428432
return (struct dcp_map_physical_resp){
429433
.dva_size = size,
430434
.mem_desc_id = id,
431-
.dva = dma_map_resource(dcp->dev, req->paddr, size,
432-
DMA_BIDIRECTIONAL, 0),
435+
.dva = dva,
433436
};
434437
}
435438

0 commit comments

Comments
 (0)