Re: [linux-next:master 6953/13205] drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum imx_dma_type' from 'const void

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

 



On Sat, Dec 12, 2020 at 12:40:22PM -0300, Fabio Estevam wrote:
> On Fri, Dec 11, 2020 at 11:54 AM Souptick Joarder <jrdr.linux@xxxxxxxxx> wrote:
> 
> > of_device_get_match_data() returns void * which is assigned to enum
> > imx_dma_type type without extracting
> > the value. Anything wrong with the previous assignment ?
> 
> The driver data is now passed via:
> imxdma->devtype = (enum imx_dma_type)of_device_get_match_data(&pdev->dev);
> 
> There was nothing wrong with the previous assignment.
> 
> The original driver used to run on non-DT platforms. Now it only runs
> on DT-platforms, which means we no longer need the platform data
> structure.
> 
> Please note that this a W=1 clang warning. gcc does not complain about it.

Correct. The clang developers explicitly wanted this behavior so I moved
it under a new warning that could be disabled on regular builds but show
up on W=1 in case people wanted to fix these occurrences.

https://reviews.llvm.org/D72231
https://github.com/ClangBuiltLinux/linux/issues/887
82f2bc2fcc01 ("kbuild: Disable -Wpointer-to-enum-cast")

> Not sure how to make clang happy in this case.

Added a cast to unsigned long or uintptr_t before the cast to the enum
should fix it.

Cheers,
Nathan




[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