[PATCH] drm/amdkfd: Fix "-Wmisleading-indentation" warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Leo Li <sunpeng.li@xxxxxxx>

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.

Signed-off-by: Leo Li <sunpeng.li@xxxxxxx>
---

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(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index 97c9846..6e1d41c 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
@@ -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);
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux