[bug report] drm/mediatek: Implement OF graphs support for display paths

Dan Carpenter dan.carpenter at linaro.org
Tue Nov 12 09:29:00 UTC 2024


Hello AngeloGioacchino Del Regno,

Commit 4c932840db1d ("drm/mediatek: Implement OF graphs support for
display paths") from Oct 17, 2024 (linux-next), leads to the
following Smatch static checker warning:

	drivers/gpu/drm/mediatek/mtk_drm_drv.c:913 mtk_drm_of_ddp_path_build_one()
	error: uninitialized symbol 'next'.

drivers/gpu/drm/mediatek/mtk_drm_drv.c
    899 static int mtk_drm_of_ddp_path_build_one(struct device *dev, enum mtk_crtc_path cpath,
    900                                          const unsigned int **out_path,
    901                                          unsigned int *out_path_len)
    902 {
    903         struct device_node *next, *prev, *vdo = dev->parent->of_node;
    904         unsigned int temp_path[DDP_COMPONENT_DRM_ID_MAX] = { 0 };
    905         unsigned int *final_ddp_path;
    906         unsigned short int idx = 0;
    907         bool ovl_adaptor_comp_added = false;
    908         int ret;
    909 
    910         /* Get the first entry for the temp_path array */
    911         ret = mtk_drm_of_get_ddp_ep_cid(vdo, 0, cpath, &next, &temp_path[idx]);
    912         if (ret) {
--> 913                 if (next && temp_path[idx] == DDP_COMPONENT_DRM_OVL_ADAPTOR) {
                            ^^^^
The first two error paths in mtk_drm_of_get_ddp_ep_cid() don't initialize "next"

    914                         dev_dbg(dev, "Adding OVL Adaptor for %pOF\n", next);
    915                         ovl_adaptor_comp_added = true;
    916                 } else {
    917                         if (next)
    918                                 dev_err(dev, "Invalid component %pOF\n", next);
    919                         else
    920                                 dev_err(dev, "Cannot find first endpoint for path %d\n", cpath);
    921 
    922                         return ret;
    923                 }
    924         }
    925         idx++;
    926 

regards,
dan carpenter


More information about the dri-devel mailing list