From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> Date: 2021-12-24 09:55:09
Il 24/12/21 09:21, Miaoqian Lin ha scritto:
The of_device_get_match_data() function may return NULL.
Add check to prevent potential null dereference.
Signed-off-by: Miaoqian Lin <redacted>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
@@ -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)
I'm confused. mtk_mipi_tx_probe() is called because this device node's
compatible match one in mtk_mipi_tx_match[]. So I think the return
value of of_device_get_match_data(dev) would not be NULL. If this is
true, this checking is redundant.
Regards,
Chun-Kuang.
@@ -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)
I'm confused. mtk_mipi_tx_probe() is called because this device node's
compatible match one in mtk_mipi_tx_match[]. So I think the return
value of of_device_get_match_data(dev) would not be NULL. If this is
true, this checking is redundant.
I think your are right, this checking is redundant. Thanks for your
reply.
Regards,
Miaoqian.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel