[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ae96299cffaacdbf51beae96e3a257c95a04ac95.camel@mediatek.com>
Date: Fri, 14 Jul 2023 09:27:14 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
Nancy Lin (林欣螢) <Nancy.Lin@...iatek.com>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>,
"angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>
CC: "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"clang-built-linux@...glegroups.com"
<clang-built-linux@...glegroups.com>,
Singo Chang (張興國)
<Singo.Chang@...iatek.com>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@...iatek.com>
Subject: Re: [PATCH v2] drm/mediatek: fix uninitialized symbol
Hi, Nancy:
On Fri, 2023-04-21 at 10:16 +0800, Nancy.Lin wrote:
> fix Smatch static checker warning
> - uninitialized symbol comp_pdev in mtk_ddp_comp_init.
>
> Fixes: 0d9eee9118b7 ("drm/mediatek: Add drm ovl_adaptor sub driver
> for MT8195")
> Signed-off-by: Nancy.Lin <nancy.lin@...iatek.com>
> ---
> v2: add Fixes tag
> ---
> drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index f114da4d36a9..e987ac4481bc 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -546,7 +546,7 @@ unsigned int
> mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
> int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp
> *comp,
> unsigned int comp_id)
> {
> - struct platform_device *comp_pdev;
> + struct platform_device *comp_pdev = NULL;
> enum mtk_ddp_comp_type type;
> struct mtk_ddp_comp_dev *priv;
> #if IS_REACHABLE(CONFIG_MTK_CMDQ)
> @@ -588,6 +588,9 @@ int mtk_ddp_comp_init(struct device_node *node,
> struct mtk_ddp_comp *comp,
> type == MTK_DSI)
> return 0;
>
> + if (!comp_pdev)
> + return -EPROBE_DEFER;
In line 566, the statement is
if (nodo) {
comp_pdev = ...
}
The comment says that only ovl_adaptoer has no device node, so the
checking should be
if (type != MTK_DISP_OVL_ADAPTOR) {
comp_pdev = ...
}
and later it would return when type = MTK_DISP_OVL_ADAPTOR,
so there would be no problem of uninitialized symbol.
Regards,
CK
> +
> priv = devm_kzalloc(comp->dev, sizeof(*priv), GFP_KERNEL);
> if (!priv)
> return -ENOMEM;
Powered by blists - more mailing lists