accel/ivpu: Remove duplicated error messages
authorJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Fri, 1 Sep 2023 09:49:48 +0000 (11:49 +0200)
committerStanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Mon, 4 Sep 2023 09:01:26 +0000 (11:01 +0200)
Reduce the number of error messages per single failure in
ivpu_dev_init() and ivpu_probe().

Most error messages are already printed by functions called
from ivpu_dev_init(). Add missed error prints in ivpu_ipc_init()
and ivpu_mmu_context_init().

Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230901094957.168898-3-stanislaw.gruszka@linux.intel.com
drivers/accel/ivpu/ivpu_drv.c
drivers/accel/ivpu/ivpu_ipc.c
drivers/accel/ivpu/ivpu_mmu_context.c

index ba79f39..4b344ab 100644 (file)
@@ -518,78 +518,54 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
        lockdep_set_class(&vdev->submitted_jobs_xa.xa_lock, &submitted_jobs_xa_lock_class_key);
 
        ret = ivpu_pci_init(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to initialize PCI device: %d\n", ret);
+       if (ret)
                goto err_xa_destroy;
-       }
 
        ret = ivpu_irq_init(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to initialize IRQs: %d\n", ret);
+       if (ret)
                goto err_xa_destroy;
-       }
 
        /* Init basic HW info based on buttress registers which are accessible before power up */
        ret = ivpu_hw_info_init(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to initialize HW info: %d\n", ret);
+       if (ret)
                goto err_xa_destroy;
-       }
 
        /* Power up early so the rest of init code can access VPU registers */
        ret = ivpu_hw_power_up(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to power up HW: %d\n", ret);
+       if (ret)
                goto err_xa_destroy;
-       }
 
        ret = ivpu_mmu_global_context_init(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to initialize global MMU context: %d\n", ret);
+       if (ret)
                goto err_power_down;
-       }
 
        ret = ivpu_mmu_init(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to initialize MMU device: %d\n", ret);
+       if (ret)
                goto err_mmu_gctx_fini;
-       }
 
        ret = ivpu_fw_init(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to initialize firmware: %d\n", ret);
+       if (ret)
                goto err_mmu_gctx_fini;
-       }
 
        ret = ivpu_ipc_init(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to initialize IPC: %d\n", ret);
+       if (ret)
                goto err_fw_fini;
-       }
 
        ret = ivpu_pm_init(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to initialize PM: %d\n", ret);
+       if (ret)
                goto err_ipc_fini;
-       }
 
        ret = ivpu_job_done_thread_init(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to initialize job done thread: %d\n", ret);
+       if (ret)
                goto err_ipc_fini;
-       }
 
        ret = ivpu_fw_load(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to load firmware: %d\n", ret);
+       if (ret)
                goto err_job_done_thread_fini;
-       }
 
        ret = ivpu_boot(vdev);
-       if (ret) {
-               ivpu_err(vdev, "Failed to boot: %d\n", ret);
+       if (ret)
                goto err_job_done_thread_fini;
-       }
 
        ivpu_pm_enable(vdev);
 
@@ -651,10 +627,8 @@ static int ivpu_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        pci_set_drvdata(pdev, vdev);
 
        ret = ivpu_dev_init(vdev);
-       if (ret) {
-               dev_err(&pdev->dev, "Failed to initialize VPU device: %d\n", ret);
+       if (ret)
                return ret;
-       }
 
        ret = drm_dev_register(&vdev->drm, 0);
        if (ret) {
index fa0af59..6b2e9db 100644 (file)
@@ -426,15 +426,20 @@ int ivpu_ipc_irq_handler(struct ivpu_device *vdev)
 int ivpu_ipc_init(struct ivpu_device *vdev)
 {
        struct ivpu_ipc_info *ipc = vdev->ipc;
-       int ret = -ENOMEM;
+       int ret;
 
        ipc->mem_tx = ivpu_bo_alloc_internal(vdev, 0, SZ_16K, DRM_IVPU_BO_WC);
-       if (!ipc->mem_tx)
-               return ret;
+       if (!ipc->mem_tx) {
+               ivpu_err(vdev, "Failed to allocate mem_tx\n");
+               return -ENOMEM;
+       }
 
        ipc->mem_rx = ivpu_bo_alloc_internal(vdev, 0, SZ_16K, DRM_IVPU_BO_WC);
-       if (!ipc->mem_rx)
+       if (!ipc->mem_rx) {
+               ivpu_err(vdev, "Failed to allocate mem_rx\n");
+               ret = -ENOMEM;
                goto err_free_tx;
+       }
 
        ipc->mm_tx = devm_gen_pool_create(vdev->drm.dev, __ffs(IVPU_IPC_ALIGNMENT),
                                          -1, "TX_IPC_JSM");
index 1d2e554..8914e34 100644 (file)
@@ -427,8 +427,10 @@ ivpu_mmu_context_init(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx, u3
        INIT_LIST_HEAD(&ctx->bo_list);
 
        ret = ivpu_mmu_pgtable_init(vdev, &ctx->pgtable);
-       if (ret)
+       if (ret) {
+               ivpu_err(vdev, "Failed to initialize pgtable for ctx %u: %d\n", context_id, ret);
                return ret;
+       }
 
        if (!context_id) {
                start = vdev->hw->ranges.global.start;