diff mbox series

thermal/drivers/mediatek/lvts_thermal: Check NULL ptr on lvts_data

Message ID 20240502-mtk-thermal-lvts-data-v1-1-65f1b0bfad37@baylibre.com (mailing list archive)
State New
Headers show
Series thermal/drivers/mediatek/lvts_thermal: Check NULL ptr on lvts_data | expand

Commit Message

Julien Panis May 2, 2024, 1:46 p.m. UTC
Verify that lvts_data is not NULL before using it.

Signed-off-by: Julien Panis <jpanis@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(+)


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

Best regards,

Comments

Daniel Lezcano May 2, 2024, 1:57 p.m. UTC | #1
On 02/05/2024 15:46, Julien Panis wrote:
> Verify that lvts_data is not NULL before using it.
> 
> Signed-off-by: Julien Panis <jpanis@baylibre.com>
> ---
> At probe, verify that lvts_data is not NULL before using it.
> ---

Applied, thanks
diff mbox series

Patch

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))