summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2017-04-28 13:10:39 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-28 14:27:26 +0200
commit5b686ccd2ea6351473537ad1baf19252fbbceade (patch)
tree650a651358780b369731fc7e2c1cd9a77ac5c69b /drivers/staging
parent5795a9a5fed75a729444f9d83fab597ec131d282 (diff)
staging: media: atomisp: kmap() can't fail
There's no need to check kmap() return value because it won't fail. If it's highmem mapping, it will receive virtual address or a new one; if it's lowmem, all kernel pages are already being mapped. (Thanks to Jan Kara for explanations) Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
index 358872393646..57295397da3e 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
@@ -333,15 +333,7 @@ static int load_and_flush_by_kmap(ia_css_ptr virt, void *data, unsigned int byte
idx = (virt - bo->start) >> PAGE_SHIFT;
offset = (virt - bo->start) - (idx << PAGE_SHIFT);
- src = (char *)kmap(bo->page_obj[idx].page);
- if (!src) {
- dev_err(atomisp_dev,
- "kmap buffer object page failed: "
- "pg_idx = %d\n", idx);
- return -EINVAL;
- }
-
- src += offset;
+ src = (char *)kmap(bo->page_obj[idx].page) + offset;
if ((bytes + offset) >= PAGE_SIZE) {
len = PAGE_SIZE - offset;
@@ -538,14 +530,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
idx = (virt - bo->start) >> PAGE_SHIFT;
offset = (virt - bo->start) - (idx << PAGE_SHIFT);
- des = (char *)kmap(bo->page_obj[idx].page);
- if (!des) {
- dev_err(atomisp_dev,
- "kmap buffer object page failed: "
- "pg_idx = %d\n", idx);
- return -EINVAL;
- }
- des += offset;
+ des = (char *)kmap(bo->page_obj[idx].page) + offset;
if ((bytes + offset) >= PAGE_SIZE) {
len = PAGE_SIZE - offset;