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

Commit 90812bf3 authored by Krishnankutty Kolathappilly's avatar Krishnankutty Kolathappilly
Browse files

qdsp6v2: Fix access issues in adsp loader



Access issues are present in adsp loader. These are introduced
by the changes made for making adsp loader an in kernel component.

Change-Id: I111c0c99710b66211cffa3340afed57dc6eabdc1
Signed-off-by: default avatarKrishnankutty Kolathappilly <kkolat@codeaurora.org>
parent 4f55d4d7
Loading
Loading
Loading
Loading
+25 −14
Original line number Diff line number Diff line
@@ -54,25 +54,36 @@ static void adsp_loader_do(struct platform_device *pdev)
	int rc = 0;
	u32 adsp_state;

	if (!pdev) {
		dev_err(&pdev->dev, "%s: Platform device null\n", __func__);
		goto fail;
	}

	if (!pdev->dev.of_node) {
		dev_err(&pdev->dev,
			"%s: Device tree information missing\n", __func__);
		goto fail;
	}

	rc = of_property_read_u32(pdev->dev.of_node, adsp_dt, &adsp_state);
	if (rc) {
		dev_err(&pdev->dev,
			"%s: ADSP state = %x\n", __func__, adsp_state);
		return;
		goto fail;
	}

	if (adsp_state == APR_SUBSYS_DOWN) {
		if (pdev) {
		priv = platform_get_drvdata(pdev);
		} else {
			pr_err("%s: Private data get failed\n", __func__);
		if (!priv) {
			dev_err(&pdev->dev,
				" %s: Private data get failed\n", __func__);
			goto fail;
		}


		priv->pil_h = subsystem_get("adsp");
		if (IS_ERR(priv->pil_h)) {
			pr_err("%s: pil get failed,\n",
			dev_err(&pdev->dev, "%s: pil get failed,\n",
				__func__);
			goto fail;
		}
@@ -86,11 +97,11 @@ static void adsp_loader_do(struct platform_device *pdev)
	}


	pr_info("%s: Q6/ADSP image is loaded\n", __func__);
	dev_info(&pdev->dev, "%s: Q6/ADSP image is loaded\n", __func__);
	return;
fail:

	pr_err("%s: Q6/ADSP image loading failed\n", __func__);
	dev_err(&pdev->dev, "%s: Q6/ADSP image loading failed\n", __func__);
	return;
}

@@ -118,9 +129,9 @@ static int adsp_loader_init_sysfs(struct platform_device *pdev)

	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
	if (!priv) {
		pr_err("%s: memory alloc failed\n", __func__);
		dev_err(&pdev->dev, "%s: memory alloc failed\n", __func__);
		ret = -ENOMEM;
		goto error_return;
		return ret;
	}

	platform_set_drvdata(pdev, priv);
@@ -131,7 +142,7 @@ static int adsp_loader_init_sysfs(struct platform_device *pdev)
				sizeof(*(priv->attr_group)),
				GFP_KERNEL);
	if (!priv->attr_group) {
		pr_err("%s: malloc attr_group failed\n",
		dev_err(&pdev->dev, "%s: malloc attr_group failed\n",
						__func__);
		ret = -ENOMEM;
		goto error_return;
@@ -141,7 +152,7 @@ static int adsp_loader_init_sysfs(struct platform_device *pdev)

	priv->boot_adsp_obj = kobject_create_and_add("boot_adsp", kernel_kobj);
	if (!priv->boot_adsp_obj) {
		pr_err("%s: sysfs create and add failed\n",
		dev_err(&pdev->dev, "%s: sysfs create and add failed\n",
						__func__);
		ret = -ENOMEM;
		goto error_return;
@@ -149,7 +160,7 @@ static int adsp_loader_init_sysfs(struct platform_device *pdev)

	ret = sysfs_create_group(priv->boot_adsp_obj, priv->attr_group);
	if (ret) {
		pr_err("%s: sysfs create group failed %d\n", \
		dev_err(&pdev->dev, "%s: sysfs create group failed %d\n",
							__func__, ret);
		goto error_return;
	}
@@ -195,7 +206,7 @@ static int adsp_loader_probe(struct platform_device *pdev)
{
	int ret = adsp_loader_init_sysfs(pdev);
	if (ret != 0) {
		pr_err("%s: Error in initing sysfs\n", __func__);
		dev_err(&pdev->dev, "%s: Error in initing sysfs\n", __func__);
		return ret;
	}