diff options
| author | Fabian Frederick <fabf@skynet.be> | 2017-04-28 08:10:39 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-28 08:27:26 -0400 |
| commit | 5b686ccd2ea6351473537ad1baf19252fbbceade (patch) | |
| tree | 650a651358780b369731fc7e2c1cd9a77ac5c69b | |
| parent | 5795a9a5fed75a729444f9d83fab597ec131d282 (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>
| -rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c | 19 |
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 | |||
| 333 | idx = (virt - bo->start) >> PAGE_SHIFT; | 333 | idx = (virt - bo->start) >> PAGE_SHIFT; |
| 334 | offset = (virt - bo->start) - (idx << PAGE_SHIFT); | 334 | offset = (virt - bo->start) - (idx << PAGE_SHIFT); |
| 335 | 335 | ||
| 336 | src = (char *)kmap(bo->page_obj[idx].page); | 336 | src = (char *)kmap(bo->page_obj[idx].page) + offset; |
| 337 | if (!src) { | ||
| 338 | dev_err(atomisp_dev, | ||
| 339 | "kmap buffer object page failed: " | ||
| 340 | "pg_idx = %d\n", idx); | ||
| 341 | return -EINVAL; | ||
| 342 | } | ||
| 343 | |||
| 344 | src += offset; | ||
| 345 | 337 | ||
| 346 | if ((bytes + offset) >= PAGE_SIZE) { | 338 | if ((bytes + offset) >= PAGE_SIZE) { |
| 347 | len = PAGE_SIZE - offset; | 339 | len = PAGE_SIZE - offset; |
| @@ -538,14 +530,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes) | |||
| 538 | idx = (virt - bo->start) >> PAGE_SHIFT; | 530 | idx = (virt - bo->start) >> PAGE_SHIFT; |
| 539 | offset = (virt - bo->start) - (idx << PAGE_SHIFT); | 531 | offset = (virt - bo->start) - (idx << PAGE_SHIFT); |
| 540 | 532 | ||
| 541 | des = (char *)kmap(bo->page_obj[idx].page); | 533 | des = (char *)kmap(bo->page_obj[idx].page) + offset; |
| 542 | if (!des) { | ||
| 543 | dev_err(atomisp_dev, | ||
| 544 | "kmap buffer object page failed: " | ||
| 545 | "pg_idx = %d\n", idx); | ||
| 546 | return -EINVAL; | ||
| 547 | } | ||
| 548 | des += offset; | ||
| 549 | 534 | ||
| 550 | if ((bytes + offset) >= PAGE_SIZE) { | 535 | if ((bytes + offset) >= PAGE_SIZE) { |
| 551 | len = PAGE_SIZE - offset; | 536 | len = PAGE_SIZE - offset; |
