Skip to contentSkip to conversation

drm/amdkfd/kfd_mqd_manager_v10: Fix missing break in switch statement

PATCH In review Gustavo A. R. Silva 3 participants 5 messages Jul 21, 2019 – Jul 22, 2019 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd/kfd_mqd_manager_v10: Fix missing break in switch statement

Add missing break statement in order to prevent the code from falling through to case KFD_MQD_TYPE_COMPUTE.

This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.

Fixes 14328aa58ce5 ("drm/amdkfd: Add navi10 support to amdkfd. (v3)")
---
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 -0
index 4f8a6ffc5775..1d8b13ad46f9 100644
@@ -430,6 +430,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,
 	switch (type) {
 	case KFD_MQD_TYPE_CP:
 		pr_debug("%s@%i\n", __func__, __LINE__);
+		break;
 	case KFD_MQD_TYPE_COMPUTE:
 		pr_debug("%s@%i\n", __func__, __LINE__);
 		mqd->allocate_mqd = allocate_mqd;
Signature · 6 lines
2.22.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

This one properly in purpose , The mqd init for CP and  COMPUTE will have the same  routine .

Regard

sshaoyun.liu

Quoted 18 lines · Gustavo A. R. Silva

Add missing break statement in order to prevent the code from falling through to case KFD_MQD_TYPE_COMPUTE.

This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.

Fixes 14328aa58ce5 ("drm/amdkfd: Add navi10 support to amdkfd. (v3)")
---
  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +0 -0
index 4f8a6ffc5775..1d8b13ad46f9 100644

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type, · line 436

Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 -0
@@ -430,6 +430,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,
  	switch (type) {
  	case KFD_MQD_TYPE_CP:
  		pr_debug("%s@%i\n", __func__, __LINE__);
+		break;
  	case KFD_MQD_TYPE_COMPUTE:
  		pr_debug("%s@%i\n", __func__, __LINE__);
  		mqd->allocate_mqd = allocate_mqd;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): c735a1cc-a545-50fb-44e7-c0ad93ee8ee7-5C7GfCeVMHo@public.gmane.org

#3 lore raw

We need to add a /*fall through */ comment then.

Alex
________________________________
From: Liu, Shaoyun <[email protected]>
Sent: Monday, July 22, 2019 11:14 AM
To: Gustavo A. R. Silva <gustavo-L1vi/[email protected]>; Cox, Philip <[email protected]>; Oded Gabbay <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; David Airlie <[email protected]>; Daniel Vetter <daniel-/[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH] drm/amdkfd/kfd_mqd_manager_v10: Fix missing break in switch statement

This one properly in purpose , The mqd init for CP and COMPUTE will have the same routine .

Regard

sshaoyun.liu

Quoted 18 lines · Gustavo A. R. Silva

Add missing break statement in order to prevent the code from falling through to case KFD_MQD_TYPE_COMPUTE.

This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.

Fixes 14328aa58ce5 ("drm/amdkfd: Add navi10 support to amdkfd. (v3)")
---
  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +0 -0
index 4f8a6ffc5775..1d8b13ad46f9 100644

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type, · line 436

Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 -0
@@ -430,6 +430,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,
       switch (type) {
       case KFD_MQD_TYPE_CP:
               pr_debug("%s@%i\n", __func__, __LINE__);
+             break;
       case KFD_MQD_TYPE_COMPUTE:
               pr_debug("%s@%i\n", __func__, __LINE__);
               mqd->allocate_mqd = allocate_mqd;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw
Quoted 2 lines · Alexander

We need to add a /*fall through */ comment then.

It might be better to remove the call to pr_debug() in KFD_MQD_TYPE_CP:

	case KFD_MQD_TYPE_CP:
       	case KFD_MQD_TYPE_COMPUTE:
		pr_debug("%s@%i\n", __func__, __LINE__);
		mqd->allocate_mqd = allocate_mqd;

Thanks
--
Gustavo

Quoted 42 lines

Alex
________________________________
From: Liu, Shaoyun <[email protected]>
Sent: Monday, July 22, 2019 11:14 AM
To: Gustavo A. R. Silva <[email protected]>; Cox, Philip <[email protected]>; Oded Gabbay <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; David Airlie <[email protected]>; Daniel Vetter <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH] drm/amdkfd/kfd_mqd_manager_v10: Fix missing break in switch statement

This one properly in purpose , The mqd init for CP and COMPUTE will have the same routine .

Regard

sshaoyun.liu

Quoted 25 lines · Gustavo A. R. Silva

Add missing break statement in order to prevent the code from falling through to case KFD_MQD_TYPE_COMPUTE.

This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.

Fixes 14328aa58ce5 ("drm/amdkfd: Add navi10 support to amdkfd. (v3)")
---
  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 -0
index 4f8a6ffc5775..1d8b13ad46f9 100644
@@ -430,6 +430,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,
       switch (type) {
       case KFD_MQD_TYPE_CP:
               pr_debug("%s@%i\n", __func__, __LINE__);
+             break;
       case KFD_MQD_TYPE_COMPUTE:
               pr_debug("%s@%i\n", __func__, __LINE__);
               mqd->allocate_mqd = allocate_mqd;
#5 lore raw

That sounds good to me .

Regards

shaoyun.liu

Quoted 57 lines · Gustavo A. R. Silva
Quoted 2 lines · Alexander

We need to add a /*fall through */ comment then.

It might be better to remove the call to pr_debug() in KFD_MQD_TYPE_CP:

	case KFD_MQD_TYPE_CP:
        	case KFD_MQD_TYPE_COMPUTE:
		pr_debug("%s@%i\n", __func__, __LINE__);
		mqd->allocate_mqd = allocate_mqd;

Thanks
--
Gustavo

Quoted 41 lines

Alex
________________________________
From: Liu, Shaoyun <[email protected]>
Sent: Monday, July 22, 2019 11:14 AM
To: Gustavo A. R. Silva <[email protected]>; Cox, Philip <[email protected]>; Oded Gabbay <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; David Airlie <[email protected]>; Daniel Vetter <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH] drm/amdkfd/kfd_mqd_manager_v10: Fix missing break in switch statement

This one properly in purpose , The mqd init for CP and COMPUTE will have the same routine .

Regard

sshaoyun.liu

Quoted 25 lines · Gustavo A. R. Silva

Add missing break statement in order to prevent the code from falling through to case KFD_MQD_TYPE_COMPUTE.

This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.

Fixes 14328aa58ce5 ("drm/amdkfd: Add navi10 support to amdkfd. (v3)")
---
   drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 1 +
   1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 -0
index 4f8a6ffc5775..1d8b13ad46f9 100644
@@ -430,6 +430,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,
        switch (type) {
        case KFD_MQD_TYPE_CP:
                pr_debug("%s@%i\n", __func__, __LINE__);
+             break;
        case KFD_MQD_TYPE_COMPUTE:
                pr_debug("%s@%i\n", __func__, __LINE__);
                mqd->allocate_mqd = allocate_mqd;