[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <33cd21877853d3f602a7403f37a30d68e9fa3e4a.camel@mediatek.com>
Date: Thu, 30 Dec 2021 09:56:07 +0800
From: Chunfeng Yun <chunfeng.yun@...iatek.com>
To: Miaoqian Lin <linmq006@...il.com>
CC: Chun-Kuang Hu <chunkuang.hu@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
Kishon Vijay Abraham I <kishon@...com>,
"Vinod Koul" <vkoul@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
<dri-devel@...ts.freedesktop.org>,
<linux-mediatek@...ts.infradead.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-phy@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] phy: mediatek: Fix missing check in mtk_mipi_tx_probe
On Fri, 2021-12-24 at 08:21 +0000, Miaoqian Lin wrote:
> The of_device_get_match_data() function may return NULL.
> Add check to prevent potential null dereference.
>
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
> drivers/phy/mediatek/phy-mtk-mipi-dsi.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/phy/mediatek/phy-mtk-mipi-dsi.c
> b/drivers/phy/mediatek/phy-mtk-mipi-dsi.c
> index 28ad9403c441..67b005d5b9e3 100644
> --- a/drivers/phy/mediatek/phy-mtk-mipi-dsi.c
> +++ b/drivers/phy/mediatek/phy-mtk-mipi-dsi.c
> @@ -146,6 +146,8 @@ static int mtk_mipi_tx_probe(struct
> platform_device *pdev)
> return -ENOMEM;
>
> mipi_tx->driver_data = of_device_get_match_data(dev);
> + if (!mipi_tx->driver_data)
> + return -ENODEV;
>
> mipi_tx->regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(mipi_tx->regs))
Acked-by: Chunfeng Yun <chunfeng.yun@...iatek.com>
Thanks
Powered by blists - more mailing lists