[bug report] drm/mediatek: Add drm ovl_adaptor sub driver for MT8195

Nancy Lin (林欣螢) Nancy.Lin at mediatek.com
Wed Apr 19 20:02:33 PDT 2023


Hi Dan,

Sorry for the warning.
I will send a patch to fix it.

Regards,
Nancy 

On Wed, 2023-04-19 at 13:20 +0300, Dan Carpenter wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Hello Nancy.Lin,
> 
> The patch 0d9eee9118b7: "drm/mediatek: Add drm ovl_adaptor sub driver
> for MT8195" from Mar 21, 2023, leads to the following Smatch static
> checker warning:
> 
>         drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c:606
> mtk_ddp_comp_init()
>         error: uninitialized symbol 'comp_pdev'.
> 
> drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
>     546 int mtk_ddp_comp_init(struct device_node *node, struct
> mtk_ddp_comp *comp,
>     547                       unsigned int comp_id)
>     548 {
>     549         struct platform_device *comp_pdev;
>     550         enum mtk_ddp_comp_type type;
>     551         struct mtk_ddp_comp_dev *priv;
>     552 #if IS_REACHABLE(CONFIG_MTK_CMDQ)
>     553         int ret;
>     554 #endif
>     555
>     556         if (comp_id < 0 || comp_id >=
> DDP_COMPONENT_DRM_ID_MAX)
>     557                 return -EINVAL;
>     558
>     559         type = mtk_ddp_matches[comp_id].type;
>     560
>     561         comp->id = comp_id;
>     562         comp->funcs = mtk_ddp_matches[comp_id].funcs;
>     563         /* Not all drm components have a DTS device node,
> such as ovl_adaptor,
>     564          * which is the drm bring up sub driver
>     565          */
>     566         if (node) {
>     567                 comp_pdev = of_find_device_by_node(node);
>     568                 if (!comp_pdev) {
>     569                         DRM_INFO("Waiting for device %s\n",
> node->full_name);
>     570                         return -EPROBE_DEFER;
>     571                 }
>     572                 comp->dev = &comp_pdev->dev;
>     573         }
> 
> comp_pdev not initialized on else path.
> 
>     574
>     575         if (type == MTK_DISP_AAL ||
>     576             type == MTK_DISP_BLS ||
>     577             type == MTK_DISP_CCORR ||
>     578             type == MTK_DISP_COLOR ||
>     579             type == MTK_DISP_GAMMA ||
>     580             type == MTK_DISP_MERGE ||
>     581             type == MTK_DISP_OVL ||
>     582             type == MTK_DISP_OVL_2L ||
>     583             type == MTK_DISP_OVL_ADAPTOR ||
>     584             type == MTK_DISP_PWM ||
>     585             type == MTK_DISP_RDMA ||
>     586             type == MTK_DPI ||
>     587             type == MTK_DP_INTF ||
>     588             type == MTK_DSI)
>     589                 return 0;
>     590
>     591         priv = devm_kzalloc(comp->dev, sizeof(*priv),
> GFP_KERNEL);
>     592         if (!priv)
>     593                 return -ENOMEM;
>     594
>     595         priv->regs = of_iomap(node, 0);
>     596         priv->clk = of_clk_get(node, 0);
>     597         if (IS_ERR(priv->clk))
>     598                 return PTR_ERR(priv->clk);
>     599
>     600 #if IS_REACHABLE(CONFIG_MTK_CMDQ)
>     601         ret = cmdq_dev_get_client_reg(comp->dev, &priv-
> >cmdq_reg, 0);
>     602         if (ret)
>     603                 dev_dbg(comp->dev, "get mediatek,gce-client-
> reg fail!\n");
>     604 #endif
>     605
> --> 606         platform_set_drvdata(comp_pdev, priv);
>                                      ^^^^^^^^^
> Warning msg triggered here.
> 
>     607
>     608         return 0;
>     609 }
> 
> regards,
> dan carpenter


More information about the Linux-mediatek mailing list