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

Commit 5e23d10b authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Fix NULL pointer dereference of of_match_device()"

parents 924826e7 fc00721e
Loading
Loading
Loading
Loading
+22 −9
Original line number Diff line number Diff line
@@ -1317,12 +1317,18 @@ static int adreno_read_speed_bin(struct platform_device *pdev,

static int adreno_probe(struct platform_device *pdev)
{
	const struct of_device_id *of_id =
		of_match_device(adreno_match_table, &pdev->dev);
	struct adreno_device *adreno_dev = (struct adreno_device *) of_id->data;
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	const struct of_device_id *of_id;
	struct adreno_device *adreno_dev;
	struct kgsl_device *device;
	int status;

	of_id = of_match_device(adreno_match_table, &pdev->dev);
	if (!of_id)
		return -EINVAL;

	adreno_dev = (struct adreno_device *) of_id->data;
	device = KGSL_DEVICE(adreno_dev);

	device->pdev = pdev;

	if (adreno_is_gpu_disabled(adreno_dev)) {
@@ -1482,11 +1488,18 @@ static void _adreno_free_memories(struct adreno_device *adreno_dev)

static int adreno_remove(struct platform_device *pdev)
{
	const struct of_device_id *of_id =
		of_match_device(adreno_match_table, &pdev->dev);
	struct adreno_device *adreno_dev = (struct adreno_device *) of_id->data;
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev);
	const struct of_device_id *of_id;
	struct adreno_device *adreno_dev;
	struct kgsl_device *device;
	struct adreno_gpudev *gpudev;

	of_id = of_match_device(adreno_match_table, &pdev->dev);
	if (!of_id)
		return -EINVAL;

	adreno_dev = (struct adreno_device *) of_id->data;
	device = KGSL_DEVICE(adreno_dev);
	gpudev = ADRENO_GPU_DEVICE(adreno_dev);

	if (gpudev->remove != NULL)
		gpudev->remove(adreno_dev);