Skip to contentSkip to conversation

drm/amdkfd: Fix "-Wmisleading-indentation" warning

PATCH In review [email protected] 2 participants 2 messages Mar 5, 2019 – Mar 6, 2019 1 message not in the archive

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

PATCH 1/1 drm/amdkfd: Fix "-Wmisleading-indentation" warning

From: Leo Li <[email protected]>

The following warning is seen during compile:

./include/linux/idr.h:212:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
for ((entry) = idr_get_next((idr), &(id)); \
^
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_events.c:1038:3: note: in expansion of macro ‘idr_for_each_entry_continue’
idr_for_each_entry_continue(&p->event_idr, ev, id) ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_events.c:1043:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’

    if (ev->type == KFD_EVENT_TYPE_MEMORY &&
    ^~

Place braces around the indented block, as seemingly intended.

---

Hi Eric,

This patch fixes the warning, but doesn't address a build error that occurs if CONFIG_HSA_AMD is not set:

ERROR: "kgd2kfd_set_sram_ecc_flag" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! scripts/Makefile.modpost:92: recipe for target '__modpost' failed make[1]: *** [__modpost] Error 1
Makefile:1260: recipe for target 'modules' failed
make: *** [modules] Error 2
make: *** Waiting for unfinished jobs....

Thanks,
Leo

 drivers/gpu/drm/amd/amdkfd/kfd_events.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_events.c +2 -1
index 97c9846..6e1d41c 100644
@@ -1035,7 +1035,7 @@ void kfd_signal_reset_event(struct kfd_dev *dev)
 	hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) {
 		mutex_lock(&p->event_mutex);
 		id = KFD_FIRST_NONSIGNAL_EVENT_ID;
-		idr_for_each_entry_continue(&p->event_idr, ev, id)
+		idr_for_each_entry_continue(&p->event_idr, ev, id) {
 			if (ev->type == KFD_EVENT_TYPE_HW_EXCEPTION) {
 				ev->hw_exception_data = hw_exception_data;
 				set_event(ev);
@@ -1045,6 +1045,7 @@ void kfd_signal_reset_event(struct kfd_dev *dev)
 				ev->memory_exception_data = memory_exception_data;
 				set_event(ev);
 			}
+		}
 		mutex_unlock(&p->event_mutex);
 	}
 	srcu_read_unlock(&kfd_processes_srcu, idx);
Signature · 6 lines
2.7.4

_______________________________________________
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): 1551814093-32107-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 15 lines · On 2019-03-05 8:28 p.m., [email protected] wrote:

From: Leo Li <[email protected]>

The following warning is seen during compile:

./include/linux/idr.h:212:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
for ((entry) = idr_get_next((idr), &(id)); \
^
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_events.c:1038:3: note: in expansion of macro ‘idr_for_each_entry_continue’
idr_for_each_entry_continue(&p->event_idr, ev, id) ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_events.c:1043:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’

Quoted 6 lines
    if (ev->type == KFD_EVENT_TYPE_MEMORY &&
    ^~

Place braces around the indented block, as seemingly intended.

Thanks Leo, but I already sent a fix for this:

https://patchwork.freedesktop.org/patch/290410/

Signature · 6 lines
Earthling Michel Dänzer               |              https://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx