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

Julien Panis posted 1 patch 4 months, 2 weeks ago
drivers/thermal/mediatek/lvts_thermal.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] thermal/drivers/mediatek/lvts_thermal: Check NULL ptr on lvts_data
Posted by Julien Panis 4 months, 2 weeks ago
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(+)

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@baylibre.com>
Re: [PATCH] thermal/drivers/mediatek/lvts_thermal: Check NULL ptr on lvts_data
Posted by Daniel Lezcano 4 months, 2 weeks ago
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

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog