[PATCH] thermal/drivers/mediatek/lvts_thermal: Check NULL ptr on lvts_data

Julien Panis jpanis at baylibre.com
Thu May 2 06:46:03 PDT 2024


Verify that lvts_data is not NULL before using it.

Signed-off-by: Julien Panis <jpanis at baylibre.com>
---
At probe, verify that lvts_data is not NULL before using it.
---
 drivers/thermal/mediatek/lvts_thermal.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index 86b2f44355ac..20a64b68f9c0 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -1271,6 +1271,8 @@ static int lvts_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	lvts_data = of_device_get_match_data(dev);
+	if (!lvts_data)
+		return -ENODEV;
 
 	lvts_td->clk = devm_clk_get_enabled(dev, NULL);
 	if (IS_ERR(lvts_td->clk))

---
base-commit: 9c6ecb3cb6e20c4fd7997047213ba0efcf9ada1a
change-id: 20240502-mtk-thermal-lvts-data-4b19d0685024

Best regards,
-- 
Julien Panis <jpanis at baylibre.com>




More information about the Linux-mediatek mailing list