All of lore.kernel.org
 help / color / mirror / Atom feed
* [trivial-mods:20200310_fallthrough_2 241/491] drivers/gpu/drm/drm_vm.c:599:3: note: in expansion of macro 'fallthrough'
@ 2020-03-11  8:29 kbuild test robot
  2020-03-11  8:43 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2020-03-11  8:29 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 7067 bytes --]

tree:   https://repo.or.cz/linux-2.6/trivial-mods.git 20200310_fallthrough_2
head:   71c55e51125d74e9bd8cce382679ee762d9a86fd
commit: 1b6369cf2ce2951c6e289e0f91cf23491728ad42 [241/491] DRM DRIVERS AND MISC GPU PATCHES: Use fallthrough;
config: arm-multi_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.2.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 1b6369cf2ce2951c6e289e0f91cf23491728ad42
        # save the attached .config to linux build tree
        GCC_VERSION=9.2.0 make.cross ARCH=arm 

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

All warnings (new ones prefixed by >>):

   In file included from include/linux/compiler_types.h:59,
                    from <command-line>:
   drivers/gpu/drm/drm_vm.c: In function 'drm_mmap_locked':
>> include/linux/compiler_attributes.h:200:41: warning: statement will never be executed [-Wswitch-unreachable]
     200 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                         ^~~~~~~~~~~~~
>> drivers/gpu/drm/drm_vm.c:599:3: note: in expansion of macro 'fallthrough'
     599 |   fallthrough; /* to _DRM_FRAME_BUFFER */
         |   ^~~~~~~~~~~
--
   In file included from include/linux/compiler_types.h:59,
                    from <command-line>:
   drivers/gpu//drm/drm_vm.c: In function 'drm_mmap_locked':
>> include/linux/compiler_attributes.h:200:41: warning: statement will never be executed [-Wswitch-unreachable]
     200 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                         ^~~~~~~~~~~~~
   drivers/gpu//drm/drm_vm.c:599:3: note: in expansion of macro 'fallthrough'
     599 |   fallthrough; /* to _DRM_FRAME_BUFFER */
         |   ^~~~~~~~~~~

vim +/fallthrough +599 drivers/gpu/drm/drm_vm.c

   515	
   516	/**
   517	 * mmap DMA memory.
   518	 *
   519	 * \param file_priv DRM file private.
   520	 * \param vma virtual memory area.
   521	 * \return zero on success or a negative number on failure.
   522	 *
   523	 * If the virtual memory area has no offset associated with it then it's a DMA
   524	 * area, so calls mmap_dma(). Otherwise searches the map in drm_device::maplist,
   525	 * checks that the restricted flag is not set, sets the virtual memory operations
   526	 * according to the mapping type and remaps the pages. Finally sets the file
   527	 * pointer and calls vm_open().
   528	 */
   529	static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
   530	{
   531		struct drm_file *priv = filp->private_data;
   532		struct drm_device *dev = priv->minor->dev;
   533		struct drm_local_map *map = NULL;
   534		resource_size_t offset = 0;
   535		struct drm_hash_item *hash;
   536	
   537		DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
   538			  vma->vm_start, vma->vm_end, vma->vm_pgoff);
   539	
   540		if (!priv->authenticated)
   541			return -EACCES;
   542	
   543		/* We check for "dma". On Apple's UniNorth, it's valid to have
   544		 * the AGP mapped at physical address 0
   545		 * --BenH.
   546		 */
   547		if (!vma->vm_pgoff
   548	#if IS_ENABLED(CONFIG_AGP)
   549		    && (!dev->agp
   550			|| dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE)
   551	#endif
   552		    )
   553			return drm_mmap_dma(filp, vma);
   554	
   555		if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash)) {
   556			DRM_ERROR("Could not find map\n");
   557			return -EINVAL;
   558		}
   559	
   560		map = drm_hash_entry(hash, struct drm_map_list, hash)->map;
   561		if (!map || ((map->flags & _DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN)))
   562			return -EPERM;
   563	
   564		/* Check for valid size. */
   565		if (map->size < vma->vm_end - vma->vm_start)
   566			return -EINVAL;
   567	
   568		if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) {
   569			vma->vm_flags &= ~(VM_WRITE | VM_MAYWRITE);
   570	#if defined(__i386__) || defined(__x86_64__)
   571			pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW;
   572	#else
   573			/* Ye gads this is ugly.  With more thought
   574			   we could move this up higher and use
   575			   `protection_map' instead.  */
   576			vma->vm_page_prot =
   577			    __pgprot(pte_val
   578				     (pte_wrprotect
   579				      (__pte(pgprot_val(vma->vm_page_prot)))));
   580	#endif
   581		}
   582	
   583		switch (map->type) {
   584	#if !defined(__arm__)
   585		case _DRM_AGP:
   586			if (dev->agp && dev->agp->cant_use_aperture) {
   587				/*
   588				 * On some platforms we can't talk to bus dma address from the CPU, so for
   589				 * memory of type DRM_AGP, we'll deal with sorting out the real physical
   590				 * pages and mappings in fault()
   591				 */
   592	#if defined(__powerpc__)
   593				vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
   594	#endif
   595				vma->vm_ops = &drm_vm_ops;
   596				break;
   597			}
   598	#endif
 > 599			fallthrough;	/* to _DRM_FRAME_BUFFER */
   600		case _DRM_FRAME_BUFFER:
   601		case _DRM_REGISTERS:
   602			offset = drm_core_get_reg_ofs(dev);
   603			vma->vm_page_prot = drm_io_prot(map, vma);
   604			if (io_remap_pfn_range(vma, vma->vm_start,
   605					       (map->offset + offset) >> PAGE_SHIFT,
   606					       vma->vm_end - vma->vm_start,
   607					       vma->vm_page_prot))
   608				return -EAGAIN;
   609			DRM_DEBUG("   Type = %d; start = 0x%lx, end = 0x%lx,"
   610				  " offset = 0x%llx\n",
   611				  map->type,
   612				  vma->vm_start, vma->vm_end, (unsigned long long)(map->offset + offset));
   613	
   614			vma->vm_ops = &drm_vm_ops;
   615			break;
   616		case _DRM_CONSISTENT:
   617			/* Consistent memory is really like shared memory. But
   618			 * it's allocated in a different way, so avoid fault */
   619			if (remap_pfn_range(vma, vma->vm_start,
   620			    page_to_pfn(virt_to_page(map->handle)),
   621			    vma->vm_end - vma->vm_start, vma->vm_page_prot))
   622				return -EAGAIN;
   623			vma->vm_page_prot = drm_dma_prot(map->type, vma);
   624			fallthrough;	/* to _DRM_SHM */
   625		case _DRM_SHM:
   626			vma->vm_ops = &drm_vm_shm_ops;
   627			vma->vm_private_data = (void *)map;
   628			break;
   629		case _DRM_SCATTER_GATHER:
   630			vma->vm_ops = &drm_vm_sg_ops;
   631			vma->vm_private_data = (void *)map;
   632			vma->vm_page_prot = drm_dma_prot(map->type, vma);
   633			break;
   634		default:
   635			return -EINVAL;	/* This should never happen. */
   636		}
   637		vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
   638	
   639		drm_vm_open_locked(dev, vma);
   640		return 0;
   641	}
   642	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 50241 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [trivial-mods:20200310_fallthrough_2 241/491] drivers/gpu/drm/drm_vm.c:599:3: note: in expansion of macro 'fallthrough'
  2020-03-11  8:29 [trivial-mods:20200310_fallthrough_2 241/491] drivers/gpu/drm/drm_vm.c:599:3: note: in expansion of macro 'fallthrough' kbuild test robot
@ 2020-03-11  8:43 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2020-03-11  8:43 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5832 bytes --]

On Wed, 2020-03-11 at 16:29 +0800, kbuild test robot wrote:
> tree:   https://repo.or.cz/linux-2.6/trivial-mods.git 20200310_fallthrough_2

So somehow the robot got this tree and compiled it
for various configs?  Nice!

How did the robot find and pull the branch?
I hadn't updated it in years.

> head:   71c55e51125d74e9bd8cce382679ee762d9a86fd
> commit: 1b6369cf2ce2951c6e289e0f91cf23491728ad42 [241/491] DRM DRIVERS AND MISC GPU PATCHES: Use fallthrough;
> config: arm-multi_v7_defconfig (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 9.2.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 1b6369cf2ce2951c6e289e0f91cf23491728ad42
>         # save the attached .config to linux build tree
>         GCC_VERSION=9.2.0 make.cross ARCH=arm 
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from include/linux/compiler_types.h:59,
>                     from <command-line>:
>    drivers/gpu/drm/drm_vm.c: In function 'drm_mmap_locked':
> > > include/linux/compiler_attributes.h:200:41: warning: statement will never be executed [-Wswitch-unreachable]
>      200 | # define fallthrough                    __attribute__((__fallthrough__))
>          |                                         ^~~~~~~~~~~~~
> > > drivers/gpu/drm/drm_vm.c:599:3: note: in expansion of macro 'fallthrough'
>      599 |   fallthrough; /* to _DRM_FRAME_BUFFER */
>          |   ^~~~~~~~~~~
> --
>    In file included from include/linux/compiler_types.h:59,
>                     from <command-line>:
>    drivers/gpu//drm/drm_vm.c: In function 'drm_mmap_locked':
> > > include/linux/compiler_attributes.h:200:41: warning: statement will never be executed [-Wswitch-unreachable]
>      200 | # define fallthrough                    __attribute__((__fallthrough__))
>          |                                         ^~~~~~~~~~~~~
>    drivers/gpu//drm/drm_vm.c:599:3: note: in expansion of macro 'fallthrough'
>      599 |   fallthrough; /* to _DRM_FRAME_BUFFER */
>          |   ^~~~~~~~~~~
> 
> vim +/fallthrough +599 drivers/gpu/drm/drm_vm.c
> 
>    515	
>    516	/**
>    517	 * mmap DMA memory.
>    518	 *
>    519	 * \param file_priv DRM file private.
>    520	 * \param vma virtual memory area.
>    521	 * \return zero on success or a negative number on failure.
>    522	 *
>    523	 * If the virtual memory area has no offset associated with it then it's a DMA
>    524	 * area, so calls mmap_dma(). Otherwise searches the map in drm_device::maplist,
>    525	 * checks that the restricted flag is not set, sets the virtual memory operations
>    526	 * according to the mapping type and remaps the pages. Finally sets the file
>    527	 * pointer and calls vm_open().
>    528	 */
>    529	static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
>    530	{
>    531		struct drm_file *priv = filp->private_data;
>    532		struct drm_device *dev = priv->minor->dev;
>    533		struct drm_local_map *map = NULL;
>    534		resource_size_t offset = 0;
>    535		struct drm_hash_item *hash;
>    536	
>    537		DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
>    538			  vma->vm_start, vma->vm_end, vma->vm_pgoff);
>    539	
>    540		if (!priv->authenticated)
>    541			return -EACCES;
>    542	
>    543		/* We check for "dma". On Apple's UniNorth, it's valid to have
>    544		 * the AGP mapped at physical address 0
>    545		 * --BenH.
>    546		 */
>    547		if (!vma->vm_pgoff
>    548	#if IS_ENABLED(CONFIG_AGP)
>    549		    && (!dev->agp
>    550			|| dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE)
>    551	#endif
>    552		    )
>    553			return drm_mmap_dma(filp, vma);
>    554	
>    555		if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash)) {
>    556			DRM_ERROR("Could not find map\n");
>    557			return -EINVAL;
>    558		}
>    559	
>    560		map = drm_hash_entry(hash, struct drm_map_list, hash)->map;
>    561		if (!map || ((map->flags & _DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN)))
>    562			return -EPERM;
>    563	
>    564		/* Check for valid size. */
>    565		if (map->size < vma->vm_end - vma->vm_start)
>    566			return -EINVAL;
>    567	
>    568		if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) {
>    569			vma->vm_flags &= ~(VM_WRITE | VM_MAYWRITE);
>    570	#if defined(__i386__) || defined(__x86_64__)
>    571			pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW;
>    572	#else
>    573			/* Ye gads this is ugly.  With more thought
>    574			   we could move this up higher and use
>    575			   `protection_map' instead.  */
>    576			vma->vm_page_prot =
>    577			    __pgprot(pte_val
>    578				     (pte_wrprotect
>    579				      (__pte(pgprot_val(vma->vm_page_prot)))));
>    580	#endif
>    581		}
>    582	
>    583		switch (map->type) {
>    584	#if !defined(__arm__)
>    585		case _DRM_AGP:
>    586			if (dev->agp && dev->agp->cant_use_aperture) {
>    587				/*
>    588				 * On some platforms we can't talk to bus dma address from the CPU, so for
>    589				 * memory of type DRM_AGP, we'll deal with sorting out the real physical
>    590				 * pages and mappings in fault()
>    591				 */
>    592	#if defined(__powerpc__)
>    593				vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
>    594	#endif
>    595				vma->vm_ops = &drm_vm_ops;
>    596				break;
>    597			}
>    598	#endif
>  > 599			fallthrough;	/* to _DRM_FRAME_BUFFER */

Right, clearly this should be inside the #endif one line up.

cheers, Joe

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-11  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11  8:29 [trivial-mods:20200310_fallthrough_2 241/491] drivers/gpu/drm/drm_vm.c:599:3: note: in expansion of macro 'fallthrough' kbuild test robot
2020-03-11  8:43 ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.