From: Haneen Mohammed <hamohammed.sa@gmail.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: outreachy-kernel <outreachy-kernel@googlegroups.com>
Subject: About handling dma_mapping_error result after dma_map_*
Date: Fri, 15 Sep 2017 01:25:02 -0600 [thread overview]
Message-ID: <20170915072502.GA11238@Haneen> (raw)
Hello,
I have a question about handling dma_mapping_error result. Is it enough
to add a warning after it? Because I have found two missing
dma_mapping_error in the drm/via driver but I wasn't sure how to handle
the return value if an error was found. Below is the code mentioned:
---
drivers/gpu/drm/via/via_dmablit.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/via/via_dmablit.c b/drivers/gpu/drm/via/via_dmablit.c
index 98aae98..5c11756 100644
--- a/drivers/gpu/drm/via/via_dmablit.c
+++ b/drivers/gpu/drm/via/via_dmablit.c
@@ -132,12 +132,19 @@ via_map_blit_for_device(struct pci_dev *pdev,
VIA_PFN(first_addr)],
VIA_PGOFF(cur_mem), remaining_len,
vsg->direction);
+ if (dma_mapping_error(&pdev->dev,
+ desc_ptr->mem_addr))
+ dev_warn(&pdev->dev, "DMA mapping failed\n");
+
desc_ptr->dev_addr = cur_fb;
desc_ptr->size = remaining_len;
desc_ptr->next = (uint32_t) next;
next = dma_map_single(&pdev->dev, desc_ptr, sizeof(*desc_ptr),
DMA_TO_DEVICE);
+ if (dma_mapping_error(&pdev->dev,
+ next))
+ dev_warn(&pdev->dev, "DMA mapping failed\n");
desc_ptr++;
if (++num_descriptors_this_page >= vsg->descriptors_per_page) {
num_descriptors_this_page = 0;
--
2.7.4
Thank you!
Haneen
next reply other threads:[~2017-09-15 7:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-15 7:25 Haneen Mohammed [this message]
2017-09-15 7:29 ` About handling dma_mapping_error result after dma_map_* Julia Lawall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170915072502.GA11238@Haneen \
--to=hamohammed.sa@gmail.com \
--cc=julia.lawall@lip6.fr \
--cc=outreachy-kernel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.