drm/mediatek: Fix void-pointer-to-enum-cast warning
authorJason-JH.Lin <jason-jh.lin@mediatek.com>
Wed, 21 Jun 2023 07:54:21 +0000 (15:54 +0800)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Sun, 13 Aug 2023 14:33:59 +0000 (14:33 +0000)
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/
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230621075421.1982-1-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
drivers/gpu/drm/mediatek/mtk_drm_drv.c

index c0a38f5..f2f6a5c 100644 (file)
@@ -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 = (enum mtk_ovl_adaptor_comp_type)(uintptr_t)of_id->data;
                id = ovl_adaptor_comp_get_id(dev, node, type);
                if (id < 0) {
                        dev_warn(dev, "Skipping unknown component %pOF\n",
index 2d0dad0..ed96489 100644 (file)
@@ -832,7 +832,7 @@ static int mtk_drm_probe(struct platform_device *pdev)
                        continue;
                }
 
-               comp_type = (enum mtk_ddp_comp_type)of_id->data;
+               comp_type = (enum mtk_ddp_comp_type)(uintptr_t)of_id->data;
 
                if (comp_type == MTK_DISP_MUTEX) {
                        int id;