re: ion: add test device for unit tests to interact with dma_bufs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Colin Cross,

The patch ceff95d49cc3: "ion: add test device for unit tests to
interact with dma_bufs" from Dec 13, 2013, leads to the following
static checker warning:

	drivers/staging/android/ion/ion_test.c:121 ion_handle_test_kernel()
	warn: missing error code here? 'dma_buf_kmap()' failed. 'ret' = '0'

drivers/staging/android/ion/ion_test.c
   112          ret = dma_buf_begin_cpu_access(dma_buf, offset, size, dir);
   113          if (ret)
   114                  return ret;
   115  
   116          while (copy_size > 0) {
   117                  size_t to_copy;
   118                  void *vaddr = dma_buf_kmap(dma_buf, page_offset);
   119  
   120                  if (!vaddr)
   121                          goto err;

In the ion_handle_test_dma we have equivalent code that sets err to
-ENOMEM.

   122  
   123                  to_copy = min_t(size_t, PAGE_SIZE - copy_offset, copy_size);
   124  
   125                  if (write)
   126                          ret = copy_from_user(vaddr + copy_offset, ptr, to_copy);
   127                  else
   128                          ret = copy_to_user(ptr, vaddr + copy_offset, to_copy);
   129  
   130                  dma_buf_kunmap(dma_buf, page_offset, vaddr);
   131                  if (ret) {
   132                          ret = -EFAULT;
   133                          goto err;
   134                  }
   135  
   136                  copy_size -= to_copy;
   137                  ptr += to_copy;
   138                  page_offset++;
   139                  copy_offset = 0;
   140          }
   141  err:
   142          dma_buf_end_cpu_access(dma_buf, offset, size, dir);
   143          return ret;
   144  }

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux