Skip to content

Commit 6f098cd

Browse files
Mani-Sadhasivamrafaeljw
authored andcommitted
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: 4f79617 ("cpufreq: qcom-hw: Move soc_data to struct qcom_cpufreq") Signed-off-by: Manivannan Sadhasivam <[email protected]> Acked-by: Viresh Kumar <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent ceaa837 commit 6f098cd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,8 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
706706
return -ENOMEM;
707707

708708
qcom_cpufreq.soc_data = of_device_get_match_data(dev);
709+
if (!qcom_cpufreq.soc_data)
710+
return -ENODEV;
709711

710712
clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, num_domains), GFP_KERNEL);
711713
if (!clk_data)

0 commit comments

Comments
 (0)