All of lore.kernel.org
 help / color / mirror / Atom feed
* small patch to avoid warning in gcc 6
@ 2016-06-08  0:41 Reinoud Koornstra
  2016-06-08  0:47 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Reinoud Koornstra @ 2016-06-08  0:41 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

Hello Everybody,

A small patch that doesn't really do anything other than getting rid
of a warning in gcc 6.1.0.

drivers/gpu/drm/i915/i915_debugfs.c: In function ‘i915_dump_lrc’:
drivers/gpu/drm/i915/i915_debugfs.c:2060:6: warning: suggest explicit
braces to avoid ambiguous ‘else’ [-Wparentheses]
   if (ctx != dev_priv->kernel_context)
      ^

Thanks,

Reinoud.

[-- Attachment #2: avoid_warning.patch --]
[-- Type: text/x-patch, Size: 560 bytes --]

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index a0f1bd7..0e30887 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2057,9 +2057,10 @@ static int i915_dump_lrc(struct seq_file *m, void *unused)
 		return ret;
 
 	list_for_each_entry(ctx, &dev_priv->context_list, link)
-		if (ctx != dev_priv->kernel_context)
+		if (ctx != dev_priv->kernel_context) {
 			for_each_ring(ring, dev_priv, i)
 				i915_dump_lrc_obj(m, ctx, ring);
+		}
 
 	mutex_unlock(&dev->struct_mutex);
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: small patch to avoid warning in gcc 6
  2016-06-08  0:41 small patch to avoid warning in gcc 6 Reinoud Koornstra
@ 2016-06-08  0:47 ` Joe Perches
  2016-06-08  0:52   ` Reinoud Koornstra
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2016-06-08  0:47 UTC (permalink / raw)
  To: Reinoud Koornstra, linux-kernel

On Tue, 2016-06-07 at 18:41 -0600, Reinoud Koornstra wrote:
> Hello Everybody,
> 
> A small patch that doesn't really do anything other than getting rid
> of a warning in gcc 6.1.0.
> 
> drivers/gpu/drm/i915/i915_debugfs.c: In function ‘i915_dump_lrc’:
> drivers/gpu/drm/i915/i915_debugfs.c:2060:6: warning: suggest explicit
> braces to avoid ambiguous ‘else’ [-Wparentheses]
>    if (ctx != dev_priv->kernel_context)
>       ^

Likely there should be 2 pairs of braces added:

	list_for_each_entry(ctx, &dev_priv->context_list, link) {
		if (ctx != dev_priv->kernel_context) {
                        for_each_ring(ring, dev_priv, i)
                                i915_dump_lrc_obj(m, ctx, ring);
		}
	}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: small patch to avoid warning in gcc 6
  2016-06-08  0:47 ` Joe Perches
@ 2016-06-08  0:52   ` Reinoud Koornstra
  0 siblings, 0 replies; 3+ messages in thread
From: Reinoud Koornstra @ 2016-06-08  0:52 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]

On Tue, Jun 7, 2016 at 6:47 PM, Joe Perches <joe@perches.com> wrote:
> On Tue, 2016-06-07 at 18:41 -0600, Reinoud Koornstra wrote:
>> Hello Everybody,
>>
>> A small patch that doesn't really do anything other than getting rid
>> of a warning in gcc 6.1.0.
>>
>> drivers/gpu/drm/i915/i915_debugfs.c: In function ‘i915_dump_lrc’:
>> drivers/gpu/drm/i915/i915_debugfs.c:2060:6: warning: suggest explicit
>> braces to avoid ambiguous ‘else’ [-Wparentheses]
>>    if (ctx != dev_priv->kernel_context)
>>       ^
>
> Likely there should be 2 pairs of braces added:
>
>         list_for_each_entry(ctx, &dev_priv->context_list, link) {
>                 if (ctx != dev_priv->kernel_context) {
>                         for_each_ring(ring, dev_priv, i)
>                                 i915_dump_lrc_obj(m, ctx, ring);
>                 }
>         }
>

Added in version 2 of the patch.
The previous patch already got rid of the warning, but this one adds
braces to the loop as well.
Thanks,

Reinoud.

[-- Attachment #2: avoid_warning.patch --]
[-- Type: text/x-patch, Size: 636 bytes --]

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index a0f1bd7..a48d228 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2056,10 +2056,12 @@ static int i915_dump_lrc(struct seq_file *m, void *unused)
 	if (ret)
 		return ret;
 
-	list_for_each_entry(ctx, &dev_priv->context_list, link)
-		if (ctx != dev_priv->kernel_context)
+	list_for_each_entry(ctx, &dev_priv->context_list, link) {
+		if (ctx != dev_priv->kernel_context) {
 			for_each_ring(ring, dev_priv, i)
 				i915_dump_lrc_obj(m, ctx, ring);
+		}
+	}
 
 	mutex_unlock(&dev->struct_mutex);
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-08  0:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-08  0:41 small patch to avoid warning in gcc 6 Reinoud Koornstra
2016-06-08  0:47 ` Joe Perches
2016-06-08  0:52   ` Reinoud Koornstra

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.