Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b91b91be authored by Mahesh Voorugonda's avatar Mahesh Voorugonda
Browse files

msm: vidc: Fix possible NULL pointer dereference



Added NULL pointer check for platform_data structure to avoid NULL
pointer dereference error. platform_data is initialized with return 
value (driver_data) of vidc_get_drv_data() fucntion where driver_data is 
initialized with NULL pointer at the beginning.

Change-Id: I24743cc6ed7ffcfa40feca2307c9b1728b5bc152
Signed-off-by: default avatarMahesh Voorugonda <mvoorugo@codeaurora.org>
parent 1a661700
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/debugfs.h>
@@ -490,6 +490,11 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev)
		return -ENOMEM;

	core->platform_data = vidc_get_drv_data(&pdev->dev);
	if(!core->platform_data) {
		d_vpr_e("Failed to get platform data\n");
		rc = -EINVAL;
		goto err_core_init;
	}
	dev_set_drvdata(&pdev->dev, core);
	rc = msm_vidc_initialize_core(pdev, core);
	if (rc) {