[linux-next:master 13882/13946] drivers//media/v4l2-core/videobuf-dma-contig.c:160:57: error: expected ')' before ';' token

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   d47175169c28eedd2cc2ab8c01f38764cb0269cc
commit: 01107ebe0c1d9159851d54bf579b202097b39470 [13882/13946] media/v4l2-core: untag user pointers in videobuf_dma_contig_user_get
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 01107ebe0c1d9159851d54bf579b202097b39470
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=sparc64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

   drivers//media/v4l2-core/videobuf-dma-contig.c: In function 'videobuf_dma_contig_user_get':
>> drivers//media/v4l2-core/videobuf-dma-contig.c:160:57: error: expected ')' before ';' token
     unsigned long untagged_baddr = untagged_addr(vb->baddr);
                                                            ^
>> drivers//media/v4l2-core/videobuf-dma-contig.c:207:1: error: expected ',' or ';' before '}' token
    }
    ^
>> drivers//media/v4l2-core/videobuf-dma-contig.c:209:32: error: invalid storage class for function '__videobuf_alloc'
    static struct videobuf_buffer *__videobuf_alloc(size_t size)
                                   ^~~~~~~~~~~~~~~~
>> drivers//media/v4l2-core/videobuf-dma-contig.c:224:14: error: invalid storage class for function '__videobuf_to_vaddr'
    static void *__videobuf_to_vaddr(struct videobuf_buffer *buf)
                 ^~~~~~~~~~~~~~~~~~~
>> drivers//media/v4l2-core/videobuf-dma-contig.c:234:12: error: invalid storage class for function '__videobuf_iolock'
    static int __videobuf_iolock(struct videobuf_queue *q,
               ^~~~~~~~~~~~~~~~~
>> drivers//media/v4l2-core/videobuf-dma-contig.c:274:12: error: invalid storage class for function '__videobuf_mmap_mapper'
    static int __videobuf_mmap_mapper(struct videobuf_queue *q,
               ^~~~~~~~~~~~~~~~~~~~~~
>> drivers//media/v4l2-core/videobuf-dma-contig.c:341:14: error: initializer element is not constant
     .alloc_vb = __videobuf_alloc,
                 ^~~~~~~~~~~~~~~~
   drivers//media/v4l2-core/videobuf-dma-contig.c:341:14: note: (near initialization for 'qops.alloc_vb')
   drivers//media/v4l2-core/videobuf-dma-contig.c:342:13: error: initializer element is not constant
     .iolock  = __videobuf_iolock,
                ^~~~~~~~~~~~~~~~~
   drivers//media/v4l2-core/videobuf-dma-contig.c:342:13: note: (near initialization for 'qops.iolock')
   drivers//media/v4l2-core/videobuf-dma-contig.c:343:17: error: initializer element is not constant
     .mmap_mapper = __videobuf_mmap_mapper,
                    ^~~~~~~~~~~~~~~~~~~~~~
   drivers//media/v4l2-core/videobuf-dma-contig.c:343:17: note: (near initialization for 'qops.mmap_mapper')
   drivers//media/v4l2-core/videobuf-dma-contig.c:344:12: error: initializer element is not constant
     .vaddr  = __videobuf_to_vaddr,
               ^~~~~~~~~~~~~~~~~~~
   drivers//media/v4l2-core/videobuf-dma-contig.c:344:12: note: (near initialization for 'qops.vaddr')
   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:8,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers//media/v4l2-core/videobuf-dma-contig.c:15:
>> drivers//media/v4l2-core/videobuf-dma-contig.c:360:19: error: non-static declaration of 'videobuf_queue_dma_contig_init' follows static declaration
    EXPORT_SYMBOL_GPL(videobuf_queue_dma_contig_init);
                      ^
   include/linux/export.h:106:21: note: in definition of macro '___export_symbol_common'
     extern typeof(sym) sym;      \
                        ^~~
>> include/linux/export.h:173:34: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL(sym,sec) ___EXPORT_SYMBOL(sym,sec)
                                     ^~~~~~~~~~~~~~~~
   include/linux/export.h:184:33: note: in expansion of macro '__EXPORT_SYMBOL'
    #define EXPORT_SYMBOL_GPL(sym)  __EXPORT_SYMBOL(sym, "_gpl")
                                    ^~~~~~~~~~~~~~~
>> drivers//media/v4l2-core/videobuf-dma-contig.c:360:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(videobuf_queue_dma_contig_init);
    ^~~~~~~~~~~~~~~~~
   drivers//media/v4l2-core/videobuf-dma-contig.c:347:6: note: previous definition of 'videobuf_queue_dma_contig_init' was here
    void videobuf_queue_dma_contig_init(struct videobuf_queue *q,
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:8,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers//media/v4l2-core/videobuf-dma-contig.c:15:
>> include/linux/export.h:108:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     static const char __kstrtab_##sym[]    \
     ^
>> include/linux/export.h:121:2: note: in expansion of macro '___export_symbol_common'
     ___export_symbol_common(sym, sec);    \
     ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/export.h:173:34: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL(sym,sec) ___EXPORT_SYMBOL(sym,sec)
                                     ^~~~~~~~~~~~~~~~
   include/linux/export.h:184:33: note: in expansion of macro '__EXPORT_SYMBOL'
    #define EXPORT_SYMBOL_GPL(sym)  __EXPORT_SYMBOL(sym, "_gpl")
                                    ^~~~~~~~~~~~~~~
>> drivers//media/v4l2-core/videobuf-dma-contig.c:360:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(videobuf_queue_dma_contig_init);
    ^~~~~~~~~~~~~~~~~
>> drivers//media/v4l2-core/videobuf-dma-contig.c:371:19: error: non-static declaration of 'videobuf_to_dma_contig' follows static declaration
    EXPORT_SYMBOL_GPL(videobuf_to_dma_contig);
                      ^
   include/linux/export.h:106:21: note: in definition of macro '___export_symbol_common'
     extern typeof(sym) sym;      \
                        ^~~
>> include/linux/export.h:173:34: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL(sym,sec) ___EXPORT_SYMBOL(sym,sec)
                                     ^~~~~~~~~~~~~~~~
   include/linux/export.h:184:33: note: in expansion of macro '__EXPORT_SYMBOL'
    #define EXPORT_SYMBOL_GPL(sym)  __EXPORT_SYMBOL(sym, "_gpl")
                                    ^~~~~~~~~~~~~~~
   drivers//media/v4l2-core/videobuf-dma-contig.c:371:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(videobuf_to_dma_contig);
    ^~~~~~~~~~~~~~~~~
   drivers//media/v4l2-core/videobuf-dma-contig.c:362:12: note: previous definition of 'videobuf_to_dma_contig' was here
    dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf)
               ^~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:8,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers//media/v4l2-core/videobuf-dma-contig.c:15:
>> include/linux/export.h:108:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     static const char __kstrtab_##sym[]    \
     ^
>> include/linux/export.h:121:2: note: in expansion of macro '___export_symbol_common'
     ___export_symbol_common(sym, sec);    \
     ^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/export.h:173:34: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL(sym,sec) ___EXPORT_SYMBOL(sym,sec)
                                     ^~~~~~~~~~~~~~~~
   include/linux/export.h:184:33: note: in expansion of macro '__EXPORT_SYMBOL'
    #define EXPORT_SYMBOL_GPL(sym)  __EXPORT_SYMBOL(sym, "_gpl")
                                    ^~~~~~~~~~~~~~~
   drivers//media/v4l2-core/videobuf-dma-contig.c:371:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(videobuf_to_dma_contig);
    ^~~~~~~~~~~~~~~~~
>> drivers//media/v4l2-core/videobuf-dma-contig.c:404:19: error: non-static declaration of 'videobuf_dma_contig_free' follows static declaration
    EXPORT_SYMBOL_GPL(videobuf_dma_contig_free);
                      ^
   include/linux/export.h:106:21: note: in definition of macro '___export_symbol_common'
     extern typeof(sym) sym;      \
                        ^~~

vim +160 drivers//media/v4l2-core/videobuf-dma-contig.c

   146	
   147	/**
   148	 * videobuf_dma_contig_user_get() - setup user space memory pointer
   149	 * @mem: per-buffer private videobuf-dma-contig data
   150	 * @vb: video buffer to map
   151	 *
   152	 * This function validates and sets up a pointer to user space memory.
   153	 * Only physically contiguous pfn-mapped memory is accepted.
   154	 *
   155	 * Returns 0 if successful.
   156	 */
   157	static int videobuf_dma_contig_user_get(struct videobuf_dma_contig_memory *mem,
   158						struct videobuf_buffer *vb)
   159	{
 > 160		unsigned long untagged_baddr = untagged_addr(vb->baddr);
   161		struct mm_struct *mm = current->mm;
   162		struct vm_area_struct *vma;
   163		unsigned long prev_pfn, this_pfn;
   164		unsigned long pages_done, user_address;
   165		unsigned int offset;
   166		int ret;
   167	
   168		offset = untagged_baddr & ~PAGE_MASK;
   169		mem->size = PAGE_ALIGN(vb->size + offset);
   170		ret = -EINVAL;
   171	
   172		down_read(&mm->mmap_sem);
   173	
   174		vma = find_vma(mm, untagged_baddr);
   175		if (!vma)
   176			goto out_up;
   177	
   178		if ((untagged_baddr + mem->size) > vma->vm_end)
   179			goto out_up;
   180	
   181		pages_done = 0;
   182		prev_pfn = 0; /* kill warning */
   183		user_address = untagged_baddr;
   184	
   185		while (pages_done < (mem->size >> PAGE_SHIFT)) {
   186			ret = follow_pfn(vma, user_address, &this_pfn);
   187			if (ret)
   188				break;
   189	
   190			if (pages_done == 0)
   191				mem->dma_handle = (this_pfn << PAGE_SHIFT) + offset;
   192			else if (this_pfn != (prev_pfn + 1))
   193				ret = -EFAULT;
   194	
   195			if (ret)
   196				break;
   197	
   198			prev_pfn = this_pfn;
   199			user_address += PAGE_SIZE;
   200			pages_done++;
   201		}
   202	
   203	out_up:
   204		up_read(&current->mm->mmap_sem);
   205	
   206		return ret;
 > 207	}
   208	
 > 209	static struct videobuf_buffer *__videobuf_alloc(size_t size)
   210	{
   211		struct videobuf_dma_contig_memory *mem;
   212		struct videobuf_buffer *vb;
   213	
   214		vb = kzalloc(size + sizeof(*mem), GFP_KERNEL);
   215		if (vb) {
   216			vb->priv = ((char *)vb) + size;
   217			mem = vb->priv;
   218			mem->magic = MAGIC_DC_MEM;
   219		}
   220	
   221		return vb;
   222	}
   223	
 > 224	static void *__videobuf_to_vaddr(struct videobuf_buffer *buf)
   225	{
   226		struct videobuf_dma_contig_memory *mem = buf->priv;
   227	
   228		BUG_ON(!mem);
   229		MAGIC_CHECK(mem->magic, MAGIC_DC_MEM);
   230	
   231		return mem->vaddr;
   232	}
   233	
 > 234	static int __videobuf_iolock(struct videobuf_queue *q,
   235				     struct videobuf_buffer *vb,
   236				     struct v4l2_framebuffer *fbuf)
   237	{
   238		struct videobuf_dma_contig_memory *mem = vb->priv;
   239	
   240		BUG_ON(!mem);
   241		MAGIC_CHECK(mem->magic, MAGIC_DC_MEM);
   242	
   243		switch (vb->memory) {
   244		case V4L2_MEMORY_MMAP:
   245			dev_dbg(q->dev, "%s memory method MMAP\n", __func__);
   246	
   247			/* All handling should be done by __videobuf_mmap_mapper() */
   248			if (!mem->vaddr) {
   249				dev_err(q->dev, "memory is not allocated/mmapped.\n");
   250				return -EINVAL;
   251			}
   252			break;
   253		case V4L2_MEMORY_USERPTR:
   254			dev_dbg(q->dev, "%s memory method USERPTR\n", __func__);
   255	
   256			/* handle pointer from user space */
   257			if (vb->baddr)
   258				return videobuf_dma_contig_user_get(mem, vb);
   259	
   260			/* allocate memory for the read() method */
   261			if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(vb->size),
   262						GFP_KERNEL))
   263				return -ENOMEM;
   264			break;
   265		case V4L2_MEMORY_OVERLAY:
   266		default:
   267			dev_dbg(q->dev, "%s memory method OVERLAY/unknown\n", __func__);
   268			return -EINVAL;
   269		}
   270	
   271		return 0;
   272	}
   273	
 > 274	static int __videobuf_mmap_mapper(struct videobuf_queue *q,
   275					  struct videobuf_buffer *buf,
   276					  struct vm_area_struct *vma)
   277	{
   278		struct videobuf_dma_contig_memory *mem;
   279		struct videobuf_mapping *map;
   280		int retval;
   281	
   282		dev_dbg(q->dev, "%s\n", __func__);
   283	
   284		/* create mapping + update buffer list */
   285		map = kzalloc(sizeof(struct videobuf_mapping), GFP_KERNEL);
   286		if (!map)
   287			return -ENOMEM;
   288	
   289		buf->map = map;
   290		map->q = q;
   291	
   292		buf->baddr = vma->vm_start;
   293	
   294		mem = buf->priv;
   295		BUG_ON(!mem);
   296		MAGIC_CHECK(mem->magic, MAGIC_DC_MEM);
   297	
   298		if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(buf->bsize),
   299					GFP_KERNEL | __GFP_COMP))
   300			goto error;
   301	
   302		/* Try to remap memory */
   303		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
   304	
   305		/* the "vm_pgoff" is just used in v4l2 to find the
   306		 * corresponding buffer data structure which is allocated
   307		 * earlier and it does not mean the offset from the physical
   308		 * buffer start address as usual. So set it to 0 to pass
   309		 * the sanity check in vm_iomap_memory().
   310		 */
   311		vma->vm_pgoff = 0;
   312	
   313		retval = vm_iomap_memory(vma, mem->dma_handle, mem->size);
   314		if (retval) {
   315			dev_err(q->dev, "mmap: remap failed with error %d. ",
   316				retval);
   317			dma_free_coherent(q->dev, mem->size,
   318					  mem->vaddr, mem->dma_handle);
   319			goto error;
   320		}
   321	
   322		vma->vm_ops = &videobuf_vm_ops;
   323		vma->vm_flags |= VM_DONTEXPAND;
   324		vma->vm_private_data = map;
   325	
   326		dev_dbg(q->dev, "mmap %p: q=%p %08lx-%08lx (%lx) pgoff %08lx buf %d\n",
   327			map, q, vma->vm_start, vma->vm_end,
   328			(long int)buf->bsize, vma->vm_pgoff, buf->i);
   329	
   330		videobuf_vm_open(vma);
   331	
   332		return 0;
   333	
   334	error:
   335		kfree(map);
   336		return -ENOMEM;
   337	}
   338	
   339	static struct videobuf_qtype_ops qops = {
   340		.magic		= MAGIC_QTYPE_OPS,
 > 341		.alloc_vb	= __videobuf_alloc,
   342		.iolock		= __videobuf_iolock,
   343		.mmap_mapper	= __videobuf_mmap_mapper,
 > 344		.vaddr		= __videobuf_to_vaddr,
   345	};
   346	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux