This patch initialize key variables and removed unused ones.
Signed-off-by: Andrew Martin <[email protected]>
---
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++--
drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +-
.../drm/amd/amdkfd/kfd_device_queue_manager.c | 38 ++++++++-----------
.../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 8 ++--
.../drm/amd/amdkfd/kfd_packet_manager_vi.c | 1 -
5 files changed, 24 insertions(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 22925df6a791..a72b242e2e73 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1506,12 +1506,12 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep,
{
struct kfd_ioctl_get_dmabuf_info_args *args = data;
struct kfd_node *dev = NULL;
- struct amdgpu_device *dmabuf_adev;
+ struct amdgpu_device *dmabuf_adev = NULL;
void *metadata_buffer = NULL;
- uint32_t flags;
- int8_t xcp_id;
+ uint32_t flags = 0;
+ int8_t xcp_id = 0;
unsigned int i;
- int r;
+ int r = 0;
/* Find a KFD GPU device that supports the get_dmabuf_info query */
for (i = 0; kfd_topology_enum_kfd_devices(i, &dev) == 0; i++)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index e9cfb80bd436..43e97b5b3b5d 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -1059,7 +1059,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;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index d7a2e7178ea9..26f1d25538a4 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -203,7 +203,7 @@ static int add_queue_mes(struct device_queue_manager *dqm,
struct queue *q,
struct amdgpu_device *adev = (struct amdgpu_device *)dqm->dev->adev;
struct kfd_process_device *pdd = qpd_to_pdd(qpd);
struct mes_add_queue_input queue_input;
- int r, queue_type;
+ int r = 0, queue_type;
uint64_t wptr_addr_off;
if (!dqm->sched_running || dqm->sched_halt)
@@ -273,7 +273,7 @@ static int remove_queue_mes(struct device_queue_manager
*dqm, struct queue *q,
struct qcm_process_device *qpd)
{
struct amdgpu_device *adev = (struct amdgpu_device *)dqm->dev->adev;
- int r;
+ int r = 0;
struct mes_remove_queue_input queue_input;
if (!dqm->sched_running || dqm->sched_halt)
@@ -624,7 +624,7 @@ static int create_queue_nocpsch(struct device_queue_manager
*dqm,
const void *restore_mqd, const void
*restore_ctl_stack)
{
struct mqd_manager *mqd_mgr;
- int retval;
+ int retval = 0;
dqm_lock(dqm);
@@ -853,11 +853,9 @@ static int destroy_queue_nocpsch_locked(struct
device_queue_manager *dqm,
struct qcm_process_device *qpd,
struct queue *q)
{
- int retval;
- struct mqd_manager *mqd_mgr;
-
- mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type(
- q->properties.type)];
+ int retval = 0;
+ struct mqd_manager *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);
@@ -912,7 +910,7 @@ static int destroy_queue_nocpsch(struct
device_queue_manager *dqm,
struct qcm_process_device *qpd,
struct queue *q)
{
- int retval;
+ int retval = 0;
uint64_t sdma_val = 0;
struct device *dev = dqm->dev->adev->dev;
struct kfd_process_device *pdd = qpd_to_pdd(qpd);
@@ -1141,7 +1139,7 @@ static int evict_process_queues_nocpsch(struct
device_queue_manager *dqm,
struct queue *q;
struct mqd_manager *mqd_mgr;
struct kfd_process_device *pdd;
- int retval, ret = 0;
+ int retval = 0, ret = 0;
dqm_lock(dqm);
if (qpd->evicted++ > 0) /* already evicted, do nothing */
@@ -1266,7 +1264,7 @@ static int restore_process_queues_nocpsch(struct
device_queue_manager *dqm,
struct kfd_process_device *pdd;
uint64_t pd_base;
uint64_t eviction_duration;
- int retval, ret = 0;
+ int retval = 0, ret = 0;
pdd = qpd_to_pdd(qpd);
/* Retrieve PD base */
@@ -1443,13 +1441,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) {
@@ -1479,7 +1476,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(
@@ -1831,8 +1828,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) {
@@ -1981,7 +1976,7 @@ static int create_queue_cpsch(struct device_queue_manager
*dqm, struct queue *q,
const struct kfd_criu_queue_priv_data *qd,
const void *restore_mqd, const void *restore_ctl_stack)
{
- int retval;
+ int retval = 0;
struct mqd_manager *mqd_mgr;
if (dqm->total_queue_count >= max_num_of_queues_per_device) {
@@ -2389,8 +2384,8 @@ static int unmap_queues_cpsch(struct device_queue_manager
*dqm,
bool reset)
{
struct device *dev = dqm->dev->adev->dev;
- struct mqd_manager *mqd_mgr;
- int retval;
+ struct mqd_manager *mqd_mgr = NULL;
+ int retval = 0;
if (!dqm->sched_running)
return 0;
@@ -2784,7 +2779,7 @@ static int checkpoint_mqd(struct device_queue_manager
*dqm,
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;
@@ -2794,8 +2789,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 */
@@ -3464,7 +3457,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;
}
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
index f2dee320fada..2e9b6bcf2704 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
@@ -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);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c
b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c
index a1de5d7e173a..8321dd01b67a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c
@@ -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);
--
2.43.0