lkml.org 
[lkml]   [2022]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.16 0779/1039] phy: mediatek: Fix missing check in mtk_mipi_tx_probe
    Date
    From: Miaoqian Lin <linmq006@gmail.com>

    [ Upstream commit 399c91c3f30531593e5ff6ca7b53f47092128669 ]

    The of_device_get_match_data() function may return NULL.
    Add check to prevent potential null dereference.

    Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Link: https://lore.kernel.org/r/20211224082103.7658-1-linmq006@gmail.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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 28ad9403c4414..67b005d5b9e35 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))
    --
    2.34.1


    \
     
     \ /
      Last update: 2022-01-25 04:10    [W:4.098 / U:0.236 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site