]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdkfd: Uninitialized and Unused variables
authorAndrew Martin <andrew.martin@amd.com>
Thu, 13 Nov 2025 16:03:59 +0000 (11:03 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 8 Dec 2025 18:56:38 +0000 (13:56 -0500)
This patch initialize key variables and removed unused ones.

Signed-off-by: Andrew Martin <andrew.martin@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_device.c
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c

index e3da2f149ae6f41a4683a8c8e0d840f1dcdc01f5..785d4bd67436521358c244892c08e3508668056c 100644 (file)
@@ -1039,7 +1039,7 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool suspend_proc)
 
 int kgd2kfd_resume(struct kfd_dev *kfd, bool resume_proc)
 {
-       int ret, i;
+       int ret = 0, i;
 
        if (!kfd->init_complete)
                return 0;
index c338088cd7a112a66e6a06b1e637c1216324cecc..d701c66179cfc245d2a0269eaeb48ce35e395910 100644 (file)
@@ -857,8 +857,7 @@ static int destroy_queue_nocpsch_locked(struct device_queue_manager *dqm,
        int retval;
        struct mqd_manager *mqd_mgr;
 
-       mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type(
-                       q->properties.type)];
+       mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type(q->properties.type)];
 
        if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE)
                deallocate_hqd(dqm, q);
@@ -1444,13 +1443,12 @@ static int register_process(struct device_queue_manager *dqm,
 static int unregister_process(struct device_queue_manager *dqm,
                                        struct qcm_process_device *qpd)
 {
-       int retval;
+       int retval = 0;
        struct device_process_node *cur, *next;
 
        pr_debug("qpd->queues_list is %s\n",
                        list_empty(&qpd->queues_list) ? "empty" : "not empty");
 
-       retval = 0;
        dqm_lock(dqm);
 
        list_for_each_entry_safe(cur, next, &dqm->queues, list) {
@@ -1480,7 +1478,7 @@ set_pasid_vmid_mapping(struct device_queue_manager *dqm, u32 pasid,
                        unsigned int vmid)
 {
        uint32_t xcc_mask = dqm->dev->xcc_mask;
-       int xcc_id, ret;
+       int xcc_id, ret = 0;
 
        for_each_inst(xcc_id, xcc_mask) {
                ret = dqm->dev->kfd2kgd->set_pasid_vmid_mapping(
@@ -1832,8 +1830,6 @@ static int start_cpsch(struct device_queue_manager *dqm)
        struct device *dev = dqm->dev->adev->dev;
        int retval, num_hw_queue_slots;
 
-       retval = 0;
-
        dqm_lock(dqm);
 
        if (!dqm->dev->kfd->shared_resources.enable_mes) {
@@ -2785,7 +2781,7 @@ dqm_unlock:
 static int process_termination_cpsch(struct device_queue_manager *dqm,
                struct qcm_process_device *qpd)
 {
-       int retval;
+       int retval = 0;
        struct queue *q;
        struct device *dev = dqm->dev->adev->dev;
        struct kernel_queue *kq, *kq_next;
@@ -2795,8 +2791,6 @@ static int process_termination_cpsch(struct device_queue_manager *dqm,
                KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES;
        bool found = false;
 
-       retval = 0;
-
        dqm_lock(dqm);
 
        /* Clean all kernel queues */
@@ -3465,7 +3459,6 @@ int suspend_queues(struct kfd_process *p,
                                        else
                                                per_device_suspended++;
                                } else if (err != -EBUSY) {
-                                       r = err;
                                        queue_ids[q_idx] |= KFD_DBG_QUEUE_ERROR_MASK;
                                        break;
                                }
index f2dee320fada42306ee8259edf912b2a72d8413b..2e9b6bcf27048bc8c8523f6011de2063eb9b62ba 100644 (file)
@@ -596,7 +596,7 @@ static int hiq_load_mqd_kiq_v9_4_3(struct mqd_manager *mm, void *mqd,
                        struct queue_properties *p, struct mm_struct *mms)
 {
        uint32_t xcc_mask = mm->dev->xcc_mask;
-       int xcc_id, err, inst = 0;
+       int xcc_id, err = 0, inst = 0;
        void *xcc_mqd;
        uint64_t hiq_mqd_size = kfd_hiq_mqd_stride(mm->dev);
 
@@ -620,7 +620,7 @@ static int destroy_hiq_mqd_v9_4_3(struct mqd_manager *mm, void *mqd,
                        uint32_t pipe_id, uint32_t queue_id)
 {
        uint32_t xcc_mask = mm->dev->xcc_mask;
-       int xcc_id, err, inst = 0;
+       int xcc_id, err = 0, inst = 0;
        uint64_t hiq_mqd_size = kfd_hiq_mqd_stride(mm->dev);
        struct v9_mqd *m;
        u32 doorbell_off;
@@ -818,7 +818,7 @@ static int destroy_mqd_v9_4_3(struct mqd_manager *mm, void *mqd,
                   uint32_t pipe_id, uint32_t queue_id)
 {
        uint32_t xcc_mask = mm->dev->xcc_mask;
-       int xcc_id, err, inst = 0;
+       int xcc_id, err = 0, inst = 0;
        void *xcc_mqd;
        struct v9_mqd *m;
        uint64_t mqd_offset;
@@ -848,7 +848,7 @@ static int load_mqd_v9_4_3(struct mqd_manager *mm, void *mqd,
        /* AQL write pointer counts in 64B packets, PM4/CP counts in dwords. */
        uint32_t wptr_shift = (p->format == KFD_QUEUE_FORMAT_AQL ? 4 : 0);
        uint32_t xcc_mask = mm->dev->xcc_mask;
-       int xcc_id, err, inst = 0;
+       int xcc_id, err = 0, inst = 0;
        void *xcc_mqd;
        uint64_t mqd_stride_size = mm->mqd_stride(mm, p);
 
index a1de5d7e173a0860fe0913234de42f53b5b4f9b1..8321dd01b67acb6bbebe281dd1362f2328fffa82 100644 (file)
@@ -174,7 +174,6 @@ static int pm_map_queues_vi(struct packet_manager *pm, uint32_t *buffer,
        case KFD_QUEUE_TYPE_SDMA_XGMI:
                packet->bitfields2.engine_sel = q->properties.sdma_engine_id +
                                engine_sel__mes_map_queues__sdma0_vi;
-               use_static = false; /* no static queues under SDMA */
                break;
        default:
                WARN(1, "queue type %d", q->properties.type);