From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "fshao@chromium.org" <fshao@chromium.org>
Cc: "linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Singo Chang (張興國)" <Singo.Chang@mediatek.com>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"clang-built-linux@googlegroups.com"
<clang-built-linux@googlegroups.com>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Subject: Re: [PATCH v2] drm/mediatek: fix uninitialized symbol
Date: Thu, 20 Jul 2023 07:52:40 +0000 [thread overview]
Message-ID: <7e1124a15395dbb6906c17e240e5011a4274a9b5.camel@mediatek.com> (raw)
In-Reply-To: <CAC=S1njEG2sV28XAWDw8FoQ0p5w=-sU4i+D-ESfapHMQC1ZW3Q@mail.gmail.com>
Hi, Fei:
On Mon, 2023-07-17 at 11:59 +0800, Fei Shao wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> Hi CK,
>
> On Fri, Jul 14, 2023 at 5:27 PM CK Hu (胡俊光) <ck.hu@mediatek.com>
> wrote:
> >
> > Hi, Nancy:
> >
> > On Fri, 2023-04-21 at 10:16 +0800, Nancy.Lin wrote:
> snip
> >
> > 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.
>
> That sounds fair, but IIUC what Nancy tries to resolve here is the
> false-positive Smatch warning.
> How about this: given the `if (node)` block was exclusively added for
> ovl_adaptor in [1], plus the init function will immediately return
> after that in this case, it should be safe to do the following
>
> ```
> /* Not all drm components have a DTS device node... */
> if (node == NULL)
> return 0;
>
> comp_pdev = of_find_device_by_node(node);
> ...
>
> if (type == MTK_DISP_AAL ||
> ...
> ```
>
> which is equivalent to adding a `node == NULL` check before [1].
> This should suppress the Smatch warning because `comp_pdev` will be
> (again) unconditionally assigned to something, and the `type ==
> MTK_DISP_OVL_ADAPTOR` line can be dropped also (optional?).
This solution also looks good to me.
Regards,
CK
>
> [1]: commit 0d9eee9118b7 ("drm/mediatek: Add drm ovl_adaptor sub
> driver for MT8195")
>
> Regards,
> Fei
next prev parent reply other threads:[~2023-07-20 7:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230421021609.7730-1-nancy.lin@mediatek.com>
2023-04-24 7:04 ` AngeloGioacchino Del Regno
2023-07-13 3:34 ` Fei Shao
2023-07-14 9:27 ` CK Hu (胡俊光)
2023-07-17 3:59 ` Fei Shao
2023-07-20 7:52 ` CK Hu (胡俊光) [this message]
2023-08-03 8:32 ` Nancy Lin (林欣螢)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7e1124a15395dbb6906c17e240e5011a4274a9b5.camel@mediatek.com \
--to=ck.hu@mediatek.com \
--cc=Nancy.Lin@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=Singo.Chang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=clang-built-linux@googlegroups.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=fshao@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=p.zabel@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®