From 10cd1eb248a00c1b1aecba752b9ba281cf2c7055 Mon Sep 17 00:00:00 2001 From: Guru Das Srinagesh Date: Wed, 20 May 2020 17:20:55 -0700 Subject: [PATCH] thermal: adc-tm: Ensure valid match data is obtained Ensure that a valid compatible string match is obtained during probe before reading any further device tree parameters. Change-Id: Idd03cfce6cc2011052ffc7fb776d7be935214172 Signed-off-by: Guru Das Srinagesh --- drivers/thermal/qcom/adc-tm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/thermal/qcom/adc-tm.c b/drivers/thermal/qcom/adc-tm.c index d442ee3aae5e..f9dae59953ae 100644 --- a/drivers/thermal/qcom/adc-tm.c +++ b/drivers/thermal/qcom/adc-tm.c @@ -214,6 +214,9 @@ static int adc_tm_get_dt_data(struct platform_device *pdev, return -EINVAL; id = of_match_node(adc_tm_match_table, node); + if (!id) + return -EINVAL; + adc_tm->data = id->data; adc_tm->ops = adc_tm->data->ops;