summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2023-02-14 12:41:15 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-02-14 17:06:10 +0300
commit6f098cde9df2c86d60db727d6270272751943674 (patch)
tree2e67bbe3be418b11b01bb1224b403e4e99e2ee0f /drivers
parentceaa837f96adb69c0df0397937cd74991d5d821a (diff)
downloadlinux-6f098cde9df2c86d60db727d6270272751943674.tar.xz
cpufreq: qcom-hw: Add missing null pointer check
of_device_get_match_data() may return NULL, so add a check to prevent potential null pointer dereference. Issue reported by Qualcomm's internal static analysis tool. Fixes: 4f7961706c63 ("cpufreq: qcom-hw: Move soc_data to struct qcom_cpufreq") Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpufreq/qcom-cpufreq-hw.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index 957cf6bb8c05..d3f55ca06ed3 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -706,6 +706,8 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
return -ENOMEM;
qcom_cpufreq.soc_data = of_device_get_match_data(dev);
+ if (!qcom_cpufreq.soc_data)
+ return -ENODEV;
clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, num_domains), GFP_KERNEL);
if (!clk_data)