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

Commit 40469098 authored by Deva Ramasubramanian's avatar Deva Ramasubramanian Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Set a valid rc if PTR_ERR is 0



In cases where IS_ERR_OR_NULL() was true, the driver was forming the
return via PTR_ERR.  However if the OR_NULL part happens to be true,
PTR_ERR(NULL) would be 0, which would generally mean success.  So, if
PTR_ERR returns 0, assign a valid error code to rc.

Change-Id: I363c69963040074e7b97d85914ea168b8eba3ab3
Signed-off-by: default avatarDeva Ramasubramanian <dramasub@codeaurora.org>
parent 7bdee1c1
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -479,7 +479,7 @@ static int msm_vidc_probe(struct platform_device *pdev)
		mutex_lock(&vidc_driver->lock);
		mutex_lock(&vidc_driver->lock);
		vidc_driver->num_cores--;
		vidc_driver->num_cores--;
		mutex_unlock(&vidc_driver->lock);
		mutex_unlock(&vidc_driver->lock);
		rc = PTR_ERR(core->device);
		rc = PTR_ERR(core->device) ?: -EBADHANDLE;
		if (rc != -EPROBE_DEFER)
		if (rc != -EPROBE_DEFER)
			dprintk(VIDC_ERR, "Failed to create HFI device\n");
			dprintk(VIDC_ERR, "Failed to create HFI device\n");
		else
		else
+1 −1
Original line number Original line Diff line number Diff line
@@ -277,7 +277,7 @@ static int msm_vidc_load_bus_vectors(struct msm_vidc_platform_resources *res)
		bus->sessions_supported = configs;
		bus->sessions_supported = configs;
		bus->pdata = msm_bus_pdata_from_node(pdev, child_node);
		bus->pdata = msm_bus_pdata_from_node(pdev, child_node);
		if (IS_ERR_OR_NULL(bus->pdata)) {
		if (IS_ERR_OR_NULL(bus->pdata)) {
			rc = PTR_ERR(bus->pdata);
			rc = PTR_ERR(bus->pdata) ?: -EBADHANDLE;
			dprintk(VIDC_ERR, "Failed to get bus pdata: %d\n", rc);
			dprintk(VIDC_ERR, "Failed to get bus pdata: %d\n", rc);
			break;
			break;
		}
		}
+2 −3
Original line number Original line Diff line number Diff line
@@ -1222,7 +1222,7 @@ static int q6_hfi_iommu_attach(struct q6_hfi_device *device)
		if (IS_ERR_OR_NULL(domain)) {
		if (IS_ERR_OR_NULL(domain)) {
			dprintk(VIDC_ERR, "Failed to get domain: %s\n",
			dprintk(VIDC_ERR, "Failed to get domain: %s\n",
					iommu_map->name);
					iommu_map->name);
			rc = IS_ERR(domain) ? PTR_ERR(domain) : -EINVAL;
			rc = PTR_ERR(domain) ?: -EINVAL;
			break;
			break;
		}
		}
		dprintk(VIDC_DBG, "Attaching domain(id:%d) %p to group %p\n",
		dprintk(VIDC_DBG, "Attaching domain(id:%d) %p to group %p\n",
@@ -1393,8 +1393,7 @@ int q6_hfi_initialize(struct hfi_device *hdev, u32 device_id,
	hdev->hfi_device_data = q6_hfi_get_device(device_id, res, callback);
	hdev->hfi_device_data = q6_hfi_get_device(device_id, res, callback);


	if (IS_ERR_OR_NULL(hdev->hfi_device_data)) {
	if (IS_ERR_OR_NULL(hdev->hfi_device_data)) {
		rc = PTR_ERR(hdev->hfi_device_data);
		rc = PTR_ERR(hdev->hfi_device_data) ?: -EINVAL;
		rc = !rc ? -EINVAL : rc;
		goto err_hfi_init;
		goto err_hfi_init;
	}
	}


+3 −4
Original line number Original line Diff line number Diff line
@@ -637,7 +637,7 @@ static int venus_hfi_iommu_attach(struct venus_hfi_device *device)
		if (IS_ERR_OR_NULL(domain)) {
		if (IS_ERR_OR_NULL(domain)) {
			dprintk(VIDC_ERR,
			dprintk(VIDC_ERR,
				"Failed to get domain: %s\n", iommu_map->name);
				"Failed to get domain: %s\n", iommu_map->name);
			rc = PTR_ERR(domain);
			rc = PTR_ERR(domain) ?: -EINVAL;
			break;
			break;
		}
		}
		rc = iommu_attach_group(domain, group);
		rc = iommu_attach_group(domain, group);
@@ -2928,7 +2928,7 @@ static inline int venus_hfi_init_clocks(struct msm_vidc_platform_resources *res,
			if (IS_ERR_OR_NULL(cl->clk)) {
			if (IS_ERR_OR_NULL(cl->clk)) {
				dprintk(VIDC_ERR,
				dprintk(VIDC_ERR,
					"Failed to get clock: %s\n", cl->name);
					"Failed to get clock: %s\n", cl->name);
				rc = PTR_ERR(cl->clk);
				rc = PTR_ERR(cl->clk) ?: -EINVAL;
				cl->clk = NULL;
				cl->clk = NULL;
				goto err_clk_get;
				goto err_clk_get;
			}
			}
@@ -3978,8 +3978,7 @@ int venus_hfi_initialize(struct hfi_device *hdev, u32 device_id,
	hdev->hfi_device_data = venus_hfi_get_device(device_id, res, callback);
	hdev->hfi_device_data = venus_hfi_get_device(device_id, res, callback);


	if (IS_ERR_OR_NULL(hdev->hfi_device_data)) {
	if (IS_ERR_OR_NULL(hdev->hfi_device_data)) {
		rc = PTR_ERR(hdev->hfi_device_data);
		rc = PTR_ERR(hdev->hfi_device_data) ?: -EINVAL;
		rc = !rc ? -EINVAL : rc;
		goto err_venus_hfi_init;
		goto err_venus_hfi_init;
	}
	}