Commit 5b686ccd authored by Fabian Frederick's avatar Fabian Frederick Committed by Greg Kroah-Hartman

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: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5795a9a5
...@@ -333,15 +333,7 @@ static int load_and_flush_by_kmap(ia_css_ptr virt, void *data, unsigned int byte ...@@ -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; idx = (virt - bo->start) >> PAGE_SHIFT;
offset = (virt - bo->start) - (idx << PAGE_SHIFT); offset = (virt - bo->start) - (idx << PAGE_SHIFT);
src = (char *)kmap(bo->page_obj[idx].page); src = (char *)kmap(bo->page_obj[idx].page) + offset;
if (!src) {
dev_err(atomisp_dev,
"kmap buffer object page failed: "
"pg_idx = %d\n", idx);
return -EINVAL;
}
src += offset;
if ((bytes + offset) >= PAGE_SIZE) { if ((bytes + offset) >= PAGE_SIZE) {
len = PAGE_SIZE - offset; len = PAGE_SIZE - offset;
...@@ -538,14 +530,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes) ...@@ -538,14 +530,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
idx = (virt - bo->start) >> PAGE_SHIFT; idx = (virt - bo->start) >> PAGE_SHIFT;
offset = (virt - bo->start) - (idx << PAGE_SHIFT); offset = (virt - bo->start) - (idx << PAGE_SHIFT);
des = (char *)kmap(bo->page_obj[idx].page); des = (char *)kmap(bo->page_obj[idx].page) + offset;
if (!des) {
dev_err(atomisp_dev,
"kmap buffer object page failed: "
"pg_idx = %d\n", idx);
return -EINVAL;
}
des += offset;
if ((bytes + offset) >= PAGE_SIZE) { if ((bytes + offset) >= PAGE_SIZE) {
len = PAGE_SIZE - offset; len = PAGE_SIZE - offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment