diff mbox series

drm/mediatek: Fix void-pointer-to-enum-cast warning

Message ID 20230620102804.17585-1-jason-jh.lin@mediatek.com (mailing list archive)
State New, archived
Headers show
Series drm/mediatek: Fix void-pointer-to-enum-cast warning | expand

Commit Message

Jason-JH.Lin June 20, 2023, 10:28 a.m. UTC
1. Fix build warning message in mtk_disp_ovl_adaptor.c
>> drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:415:10: warning: cast to smaller integer type 'enum mtk_ovl_adaptor_comp_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
                   type = (enum mtk_ovl_adaptor_comp_type)of_id->data;

                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                1 warning generated.

2. Also fix the same warning message in mtk_drm_drv.c
>> drivers/gpu/drm/mediatek/mtk_drm_drv.c:832:15: warning: cast to smaller integer type 'enum mtk_ddp_comp_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
                   comp_type = (enum mtk_ddp_comp_type)of_id->data;

                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                1 warning generated.

Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Fixes: 453c3364632a ("drm/mediatek: Add ovl_adaptor support for MT8195")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202305042054.ZtWME9OU-lkp@intel.com/
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 2 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

kernel test robot June 21, 2023, 12:51 a.m. UTC | #1
Hi Jason-JH.Lin,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v6.4-rc7 next-20230620]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jason-JH-Lin/drm-mediatek-Fix-void-pointer-to-enum-cast-warning/20230620-182906
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20230620102804.17585-1-jason-jh.lin%40mediatek.com
patch subject: [PATCH] drm/mediatek: Fix void-pointer-to-enum-cast warning
config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20230621/202306210852.JWLKcawy-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230621/202306210852.JWLKcawy-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306210852.JWLKcawy-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c: In function 'ovl_adaptor_comp_init':
>> drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:429:24: error: incompatible types when assigning to type 'enum mtk_ovl_adaptor_comp_type' from type 'const void *'
     429 |                 type = of_id->data;
         |                        ^~~~~
--
   drivers/gpu/drm/mediatek/mtk_drm_drv.c: In function 'mtk_drm_probe':
>> drivers/gpu/drm/mediatek/mtk_drm_drv.c:831:29: error: incompatible types when assigning to type 'enum mtk_ddp_comp_type' from type 'const void *'
     831 |                 comp_type = of_id->data;
         |                             ^~~~~


vim +429 drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c

   405	
   406	static int ovl_adaptor_comp_init(struct device *dev, struct component_match **match)
   407	{
   408		struct mtk_disp_ovl_adaptor *priv = dev_get_drvdata(dev);
   409		struct device_node *node, *parent;
   410		struct platform_device *comp_pdev;
   411	
   412		parent = dev->parent->parent->of_node->parent;
   413	
   414		for_each_child_of_node(parent, node) {
   415			const struct of_device_id *of_id;
   416			enum mtk_ovl_adaptor_comp_type type;
   417			int id;
   418	
   419			of_id = of_match_node(mtk_ovl_adaptor_comp_dt_ids, node);
   420			if (!of_id)
   421				continue;
   422	
   423			if (!of_device_is_available(node)) {
   424				dev_dbg(dev, "Skipping disabled component %pOF\n",
   425					node);
   426				continue;
   427			}
   428	
 > 429			type = of_id->data;
   430			id = ovl_adaptor_comp_get_id(dev, node, type);
   431			if (id < 0) {
   432				dev_warn(dev, "Skipping unknown component %pOF\n",
   433					 node);
   434				continue;
   435			}
   436	
   437			comp_pdev = of_find_device_by_node(node);
   438			if (!comp_pdev)
   439				return -EPROBE_DEFER;
   440	
   441			priv->ovl_adaptor_comp[id] = &comp_pdev->dev;
   442	
   443			drm_of_component_match_add(dev, match, compare_of, node);
   444			dev_dbg(dev, "Adding component match for %pOF\n", node);
   445		}
   446	
   447		if (!*match) {
   448			dev_err(dev, "No match device for ovl_adaptor\n");
   449			return -ENODEV;
   450		}
   451	
   452		return 0;
   453	}
   454
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
index c0a38f5217ee..081f0e681092 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
@@ -426,7 +426,7 @@  static int ovl_adaptor_comp_init(struct device *dev, struct component_match **ma
 			continue;
 		}
 
-		type = (enum mtk_ovl_adaptor_comp_type)of_id->data;
+		type = of_id->data;
 		id = ovl_adaptor_comp_get_id(dev, node, type);
 		if (id < 0) {
 			dev_warn(dev, "Skipping unknown component %pOF\n",
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 6dcb4ba2466c..4746cf95e0f2 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -829,7 +829,7 @@  static int mtk_drm_probe(struct platform_device *pdev)
 			continue;
 		}
 
-		comp_type = (enum mtk_ddp_comp_type)of_id->data;
+		comp_type = of_id->data;
 
 		if (comp_type == MTK_DISP_MUTEX) {
 			int id;