drm/amdkfd: Add curly braces around idr_for_each_entry_continue loop
Subsystems (3)
PATCH 1/1 drm/amdkfd: Add curly braces around idr_for_each_entry_continue loop
From: Michel Dänzer <[email protected]>
The compiler pointed out that one if block unintentionally wasn't part of the loop:
In file included from ./include/linux/kernfs.h:14,
from ./include/linux/sysfs.h:16,
from ./include/linux/kobject.h:20,
from ./include/linux/device.h:16,
from ./include/linux/node.h:18,
from ./include/linux/memory.h:19,
from drivers/gpu/drm//amd/amdgpu/../amdkfd/kfd_events.c:30:drivers/gpu/drm//amd/amdgpu/../amdkfd/kfd_events.c: In function ‘kfd_signal_reset_event’:./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 &&
^~---
This is one reason why I think it's better to always use curly braces around multiple lines, even if it happens to be a single statement.
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
@@ -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.20.1 _______________________________________________ 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): 20190305112004.12369-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Deucher, Alexander
Reviewed-by________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Michel Dänzer <[email protected]>
Sent: Tuesday, March 5, 2019 6:20 AM
To: [email protected]
Subject: [PATCH] drm/amdkfd: Add curly braces around idr_for_each_entry_continue loop
From: Michel Dänzer <[email protected]>
The compiler pointed out that one if block unintentionally wasn't part of the loop:
In file included from ./include/linux/kernfs.h:14,
from ./include/linux/sysfs.h:16,
from ./include/linux/kobject.h:20,
from ./include/linux/device.h:16,
from ./include/linux/node.h:18,
from ./include/linux/memory.h:19,
from drivers/gpu/drm//amd/amdgpu/../amdkfd/kfd_events.c:30:drivers/gpu/drm//amd/amdgpu/../amdkfd/kfd_events.c: In function ‘kfd_signal_reset_event’:./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 &&
^~---
This is one reason why I think it's better to always use curly braces around multiple lines, even if it happens to be a single statement.
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
@@ -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.20.1
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Kuehling, Felix
Reviewed-by Felix KuehlingQuoted 23 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
The compiler pointed out that one if block unintentionally wasn't part of the loop:
In file included from
./include/linux/kernfs.h:14,from ./include/linux/sysfs.h:16, from ./include/linux/kobject.h:20, from ./include/linux/device.h:16, from ./include/linux/node.h:18, from ./include/linux/memory.h:19, from drivers/gpu/drm//amd/amdgpu/../amdkfd/kfd_events.c:30: drivers/gpu/drm//amd/amdgpu/../amdkfd/kfd_events.c: In function ‘kfd_signal_reset_event’: ./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 && ^~
Quoted 2 lines
Fixes "drm/amdkfd: add RAS ECC event support"Signed-off-by Michel Dänzer <[email protected]>
Quoted 22 lines
---
This is one reason why I think it's better to always use curly braces around multiple lines, even if it happens to be a single statement.
drivers/gpu/drm/amd/amdkfd/kfd_events.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_events.c +1
-1@@ -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);
drivers/gpu/drm/amd/amdkfd/kfd_events.c void kfd_signal_reset_event(struct kfd_dev *dev) · line 1051
Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_events.c +1
-0@@ -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);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx