mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [hverkuil-media-tree:for-v6.1c 3/3] drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:905:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *'
@ 2022-08-19  2:05 kernel test robot
  2022-08-19 15:32 ` Hans Verkuil
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2022-08-19  2:05 UTC (permalink / raw)
  To: Moudy Ho
  Cc: llvm, kbuild-all, linux-kernel, Hans Verkuil, Ping-Hsun Wu,
	daoyuan huang

tree:   git://linuxtv.org/hverkuil/media_tree.git for-v6.1c
head:   b2273b84e1291c52279edf13b08744833c1faaab
commit: b2273b84e1291c52279edf13b08744833c1faaab [3/3] media: platform: mtk-mdp3: add MediaTek MDP3 driver
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20220819/202208190957.uDT8XE6b-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project aed5e3bea138ce581d682158eb61c27b3cfdd6ec)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        git remote add hverkuil-media-tree git://linuxtv.org/hverkuil/media_tree.git
        git fetch --no-tags hverkuil-media-tree for-v6.1c
        git checkout b2273b84e1291c52279edf13b08744833c1faaab
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/media/platform/mediatek/mdp3/ drivers/vfio/pci/hisilicon/

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

All warnings (new ones prefixed by >>):

>> drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:905:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
                   type = (enum mdp_comp_type)of_id->data;
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:964:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
                   type = (enum mdp_comp_type)of_id->data;
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   2 warnings generated.


vim +905 drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c

   883	
   884	static int mdp_comp_sub_create(struct mdp_dev *mdp)
   885	{
   886		struct device *dev = &mdp->pdev->dev;
   887		struct device_node *node, *parent;
   888	
   889		parent = dev->of_node->parent;
   890	
   891		for_each_child_of_node(parent, node) {
   892			const struct of_device_id *of_id;
   893			enum mdp_comp_type type;
   894			int id, alias_id;
   895			struct mdp_comp *comp;
   896	
   897			of_id = of_match_node(mdp_sub_comp_dt_ids, node);
   898			if (!of_id)
   899				continue;
   900			if (!of_device_is_available(node)) {
   901				dev_dbg(dev, "Skipping disabled sub comp. %pOF\n", node);
   902				continue;
   903			}
   904	
 > 905			type = (enum mdp_comp_type)of_id->data;
   906			alias_id = mdp_comp_alias_id[type];
   907			id = mdp_comp_get_id(type, alias_id);
   908			if (id < 0) {
   909				dev_err(dev,
   910					"Fail to get sub comp. id: type %d alias %d\n",
   911					type, alias_id);
   912				return -EINVAL;
   913			}
   914			mdp_comp_alias_id[type]++;
   915	
   916			comp = mdp_comp_create(mdp, node, id);
   917			if (IS_ERR(comp))
   918				return PTR_ERR(comp);
   919		}
   920	
   921		return 0;
   922	}
   923	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [hverkuil-media-tree:for-v6.1c 3/3] drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:905:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *'
  2022-08-19  2:05 [hverkuil-media-tree:for-v6.1c 3/3] drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:905:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *' kernel test robot
@ 2022-08-19 15:32 ` Hans Verkuil
  2022-08-20  1:28   ` Moudy Ho (何宗原)
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2022-08-19 15:32 UTC (permalink / raw)
  To: kernel test robot, Moudy Ho
  Cc: llvm, kbuild-all, linux-kernel, Ping-Hsun Wu, daoyuan huang

Hi Moudy,

On 19/08/2022 04:05, kernel test robot wrote:
> tree:   git://linuxtv.org/hverkuil/media_tree.git for-v6.1c
> head:   b2273b84e1291c52279edf13b08744833c1faaab
> commit: b2273b84e1291c52279edf13b08744833c1faaab [3/3] media: platform: mtk-mdp3: add MediaTek MDP3 driver
> config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20220819/202208190957.uDT8XE6b-lkp@intel.com/config)
> compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project aed5e3bea138ce581d682158eb61c27b3cfdd6ec)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install arm64 cross compiling tool for clang build
>         # apt-get install binutils-aarch64-linux-gnu
>         git remote add hverkuil-media-tree git://linuxtv.org/hverkuil/media_tree.git
>         git fetch --no-tags hverkuil-media-tree for-v6.1c
>         git checkout b2273b84e1291c52279edf13b08744833c1faaab
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/media/platform/mediatek/mdp3/ drivers/vfio/pci/hisilicon/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>>> drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:905:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
>                    type = (enum mdp_comp_type)of_id->data;
>                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:964:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
>                    type = (enum mdp_comp_type)of_id->data;
>                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Can you fix this? I believe you need to do this to fix this:

(enum mdp_comp_type)(uintptr_t)of_id->data

Regards,

	Hans

>    2 warnings generated.
> 
> 
> vim +905 drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
> 
>    883	
>    884	static int mdp_comp_sub_create(struct mdp_dev *mdp)
>    885	{
>    886		struct device *dev = &mdp->pdev->dev;
>    887		struct device_node *node, *parent;
>    888	
>    889		parent = dev->of_node->parent;
>    890	
>    891		for_each_child_of_node(parent, node) {
>    892			const struct of_device_id *of_id;
>    893			enum mdp_comp_type type;
>    894			int id, alias_id;
>    895			struct mdp_comp *comp;
>    896	
>    897			of_id = of_match_node(mdp_sub_comp_dt_ids, node);
>    898			if (!of_id)
>    899				continue;
>    900			if (!of_device_is_available(node)) {
>    901				dev_dbg(dev, "Skipping disabled sub comp. %pOF\n", node);
>    902				continue;
>    903			}
>    904	
>  > 905			type = (enum mdp_comp_type)of_id->data;
>    906			alias_id = mdp_comp_alias_id[type];
>    907			id = mdp_comp_get_id(type, alias_id);
>    908			if (id < 0) {
>    909				dev_err(dev,
>    910					"Fail to get sub comp. id: type %d alias %d\n",
>    911					type, alias_id);
>    912				return -EINVAL;
>    913			}
>    914			mdp_comp_alias_id[type]++;
>    915	
>    916			comp = mdp_comp_create(mdp, node, id);
>    917			if (IS_ERR(comp))
>    918				return PTR_ERR(comp);
>    919		}
>    920	
>    921		return 0;
>    922	}
>    923	
> 

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

* RE: [hverkuil-media-tree:for-v6.1c 3/3] drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:905:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *'
  2022-08-19 15:32 ` Hans Verkuil
@ 2022-08-20  1:28   ` Moudy Ho (何宗原)
  0 siblings, 0 replies; 3+ messages in thread
From: Moudy Ho (何宗原) @ 2022-08-20  1:28 UTC (permalink / raw)
  To: Hans Verkuil, kernel test robot
  Cc: llvm, kbuild-all, linux-kernel,
	Ping-Hsun Wu (吳秉勳),
	Daoyuan Huang (黃道原)

Hi Hans,

-----Original Message-----
From: Hans Verkuil <hverkuil@xs4all.nl> 
Sent: Friday, August 19, 2022 11:32 PM
To: kernel test robot <lkp@intel.com>; Moudy Ho (何宗原) <Moudy.Ho@mediatek.com>
Cc: llvm@lists.linux.dev; kbuild-all@lists.01.org; linux-kernel@vger.kernel.org; Ping-Hsun Wu (吳秉勳) <Ping-hsun.Wu@mediatek.com>; Daoyuan Huang (黃道原) <Daoyuan.Huang@mediatek.com>
Subject: Re: [hverkuil-media-tree:for-v6.1c 3/3] drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:905:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *'

Hi Moudy,

On 19/08/2022 04:05, kernel test robot wrote:
> tree:   git://linuxtv.org/hverkuil/media_tree.git for-v6.1c
> head:   b2273b84e1291c52279edf13b08744833c1faaab
> commit: b2273b84e1291c52279edf13b08744833c1faaab [3/3] media: platform: mtk-mdp3: add MediaTek MDP3 driver
> config: arm64-allyesconfig (https://urldefense.com/v3/__https://download.01.org/0day-ci/archive/20220819/202208190957.uDT8XE6b-lkp@intel.com/config__;!!CTRNKA9wMg0ARbw!1Df-E_WYS176tEdx2heFID6im8H-KoRsJ-9SglGQaq0RQs1Cmm1lRhN-JgrB0r9N$ )
> compiler: clang version 16.0.0 (https://urldefense.com/v3/__https://github.com/llvm/llvm-project__;!!CTRNKA9wMg0ARbw!1Df-E_WYS176tEdx2heFID6im8H-KoRsJ-9SglGQaq0RQs1Cmm1lRhN-JjsVf7Us$  aed5e3bea138ce581d682158eb61c27b3cfdd6ec)
> reproduce (this is a W=1 build):
>         wget https://urldefense.com/v3/__https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross__;!!CTRNKA9wMg0ARbw!1Df-E_WYS176tEdx2heFID6im8H-KoRsJ-9SglGQaq0RQs1Cmm1lRhN-JqmZyqvI$  -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install arm64 cross compiling tool for clang build
>         # apt-get install binutils-aarch64-linux-gnu
>         git remote add hverkuil-media-tree git://linuxtv.org/hverkuil/media_tree.git
>         git fetch --no-tags hverkuil-media-tree for-v6.1c
>         git checkout b2273b84e1291c52279edf13b08744833c1faaab
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/media/platform/mediatek/mdp3/ drivers/vfio/pci/hisilicon/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>>> drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:905:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
>                    type = (enum mdp_comp_type)of_id->data;
>                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:964:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
>                    type = (enum mdp_comp_type)of_id->data;
>                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Can you fix this? I believe you need to do this to fix this:

(enum mdp_comp_type)(uintptr_t)of_id->data

Regards,

	Hans

Apologies for not detecting this warning in my previous tests.
The changes you recommend are necessary and helpful, I'll update my drivers to make it more robust.

Thanks & Regards,
Moudy

>    2 warnings generated.
> 
> 
> vim +905 drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
> 
>    883	
>    884	static int mdp_comp_sub_create(struct mdp_dev *mdp)
>    885	{
>    886		struct device *dev = &mdp->pdev->dev;
>    887		struct device_node *node, *parent;
>    888	
>    889		parent = dev->of_node->parent;
>    890	
>    891		for_each_child_of_node(parent, node) {
>    892			const struct of_device_id *of_id;
>    893			enum mdp_comp_type type;
>    894			int id, alias_id;
>    895			struct mdp_comp *comp;
>    896	
>    897			of_id = of_match_node(mdp_sub_comp_dt_ids, node);
>    898			if (!of_id)
>    899				continue;
>    900			if (!of_device_is_available(node)) {
>    901				dev_dbg(dev, "Skipping disabled sub comp. %pOF\n", node);
>    902				continue;
>    903			}
>    904	
>  > 905			type = (enum mdp_comp_type)of_id->data;
>    906			alias_id = mdp_comp_alias_id[type];
>    907			id = mdp_comp_get_id(type, alias_id);
>    908			if (id < 0) {
>    909				dev_err(dev,
>    910					"Fail to get sub comp. id: type %d alias %d\n",
>    911					type, alias_id);
>    912				return -EINVAL;
>    913			}
>    914			mdp_comp_alias_id[type]++;
>    915	
>    916			comp = mdp_comp_create(mdp, node, id);
>    917			if (IS_ERR(comp))
>    918				return PTR_ERR(comp);
>    919		}
>    920	
>    921		return 0;
>    922	}
>    923	
> 

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

end of thread, other threads:[~2022-08-20  1:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-19  2:05 [hverkuil-media-tree:for-v6.1c 3/3] drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:905:10: warning: cast to smaller integer type 'enum mdp_comp_type' from 'const void *' kernel test robot
2022-08-19 15:32 ` Hans Verkuil
2022-08-20  1:28   ` Moudy Ho (何宗原)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®