<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Michel Dänzer <michel@daenzer.net><br>
<b>Sent:</b> Tuesday, March 5, 2019 6:20 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> [PATCH] drm/amdkfd: Add curly braces around idr_for_each_entry_continue loop</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">From: Michel Dänzer <michel.daenzer@amd.com><br>
<br>
The compiler pointed out that one if block unintentionally wasn't part<br>
of the loop:<br>
<br>
In file included from ./include/linux/kernfs.h:14,<br>
                 from ./include/linux/sysfs.h:16,<br>
                 from ./include/linux/kobject.h:20,<br>
                 from ./include/linux/device.h:16,<br>
                 from ./include/linux/node.h:18,<br>
                 from ./include/linux/memory.h:19,<br>
                 from drivers/gpu/drm//amd/amdgpu/../amdkfd/kfd_events.c:30:<br>
drivers/gpu/drm//amd/amdgpu/../amdkfd/kfd_events.c: In function ‘kfd_signal_reset_event’:<br>
./include/linux/idr.h:212:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]<br>
  for ((entry) = idr_get_next((idr), &(id));   \<br>
  ^~~<br>
drivers/gpu/drm//amd/amdgpu/../amdkfd/kfd_events.c:1038:3: note: in expansion of macro ‘idr_for_each_entry_continue’<br>
   idr_for_each_entry_continue(&p->event_idr, ev, id)<br>
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
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’<br>
    if (ev->type == KFD_EVENT_TYPE_MEMORY &&<br>
    ^~<br>
<br>
Fixes: "drm/amdkfd: add RAS ECC event support"<br>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com><br>
---<br>
<br>
This is one reason why I think it's better to always use curly braces<br>
around multiple lines, even if it happens to be a single statement.<br>
<br>
 drivers/gpu/drm/amd/amdkfd/kfd_events.c | 3 ++-<br>
 1 file changed, 2 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c<br>
index 97c984684973..6e1d41c5bf86 100644<br>
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c<br>
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c<br>
@@ -1035,7 +1035,7 @@ void kfd_signal_reset_event(struct kfd_dev *dev)<br>
         hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) {<br>
                 mutex_lock(&p->event_mutex);<br>
                 id = KFD_FIRST_NONSIGNAL_EVENT_ID;<br>
-               idr_for_each_entry_continue(&p->event_idr, ev, id)<br>
+               idr_for_each_entry_continue(&p->event_idr, ev, id) {<br>
                         if (ev->type == KFD_EVENT_TYPE_HW_EXCEPTION) {<br>
                                 ev->hw_exception_data = hw_exception_data;<br>
                                 set_event(ev);<br>
@@ -1045,6 +1045,7 @@ void kfd_signal_reset_event(struct kfd_dev *dev)<br>
                                 ev->memory_exception_data = memory_exception_data;<br>
                                 set_event(ev);<br>
                         }<br>
+               }<br>
                 mutex_unlock(&p->event_mutex);<br>
         }<br>
         srcu_read_unlock(&kfd_processes_srcu, idx);<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>