* [PATCH] drm/amdkfd: Add curly braces around idr_for_each_entry_continue loop
@ 2019-03-05 11:20 Michel Dänzer
[not found] ` <20190305112004.12369-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Michel Dänzer @ 2019-03-05 11:20 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
From: Michel Dänzer <michel.daenzer@amd.com>
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 &&
^~
Fixes: "drm/amdkfd: add RAS ECC event support"
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
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(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index 97c984684973..6e1d41c5bf86 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.20.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdkfd: Add curly braces around idr_for_each_entry_continue loop
[not found] ` <20190305112004.12369-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2019-03-05 16:17 ` Deucher, Alexander
2019-03-05 21:22 ` Kuehling, Felix
1 sibling, 0 replies; 3+ messages in thread
From: Deucher, Alexander @ 2019-03-05 16:17 UTC (permalink / raw)
To: Michel Dänzer, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
[-- Attachment #1.1: Type: text/plain, Size: 3432 bytes --]
Reviewed-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Michel Dänzer <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
Sent: Tuesday, March 5, 2019 6:20 AM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH] drm/amdkfd: Add curly braces around idr_for_each_entry_continue loop
From: Michel Dänzer <michel.daenzer-5C7GfCeVMHo@public.gmane.org>
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 &&
^~
Fixes: "drm/amdkfd: add RAS ECC event support"
Signed-off-by: Michel Dänzer <michel.daenzer-5C7GfCeVMHo@public.gmane.org>
---
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(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index 97c984684973..6e1d41c5bf86 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.20.1
_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[-- Attachment #1.2: Type: text/html, Size: 6569 bytes --]
[-- Attachment #2: Type: text/plain, Size: 153 bytes --]
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdkfd: Add curly braces around idr_for_each_entry_continue loop
[not found] ` <20190305112004.12369-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-03-05 16:17 ` Deucher, Alexander
@ 2019-03-05 21:22 ` Kuehling, Felix
1 sibling, 0 replies; 3+ messages in thread
From: Kuehling, Felix @ 2019-03-05 21:22 UTC (permalink / raw)
To: Michel Dänzer, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
On 2019-03-05 6:20 a.m., Michel Dänzer wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> 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 &&
> ^~
>
> Fixes: "drm/amdkfd: add RAS ECC event support"
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
>
> 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(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> index 97c984684973..6e1d41c5bf86 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);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-05 21:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-05 11:20 [PATCH] drm/amdkfd: Add curly braces around idr_for_each_entry_continue loop Michel Dänzer
[not found] ` <20190305112004.12369-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-03-05 16:17 ` Deucher, Alexander
2019-03-05 21:22 ` Kuehling, Felix
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.