drivers: cec: fix cert_c defect

Add a sanity check on cec->soc, which could be NULL.

CID 490328

Bug 3512545

Change-Id: Ibd334c5637a85342ed5307eecb697416f32e0360
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2710156
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Prateek Patel
2022-05-10 04:40:15 +00:00
committed by Jon Hunter
parent 070456617d
commit 658d1e1452

View File

@@ -747,6 +747,12 @@ static int tegra_cec_probe(struct platform_device *pdev)
return -ENOMEM;
cec->soc = of_device_get_match_data(&pdev->dev);
if (cec->soc == NULL) {
dev_err(&pdev->dev, "No cec dev table found\n");
devm_kfree(&pdev->dev, cec);
return -ENODEV;
}
if (cec->soc->cec_always_on && reset_retry_count != 0) {
rst = devm_reset_control_get(&pdev->dev, "cec");
if (IS_ERR(rst)) {