Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/crt: Silence compiler warning for uninitialised status
@ 2017-11-07 18:46 Chris Wilson
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-11-07 18:46 UTC (permalink / raw)
  To: intel-gfx

clang is confused by our if-else-chain that abruptly exits before a
final else:

drivers/gpu/drm/i915/intel_crt.c:821:11: warning: variable 'status' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        else if (ret < 0)
                 ^~~~~~~
drivers/gpu/drm/i915/intel_crt.c:826:9: note: uninitialized use occurs here
        return status;
               ^~~~~~
drivers/gpu/drm/i915/intel_crt.c:821:7: note: remove the 'if' if its condition is always true
        else if (ret < 0)
             ^~~~~~~~~~~~
drivers/gpu/drm/i915/intel_crt.c:761:12: note: initialize the variable 'status' to silence this warning
        int status, ret;

In this case, we can reduce the final else-if clause to an unconditional else.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_crt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 9c000ac612da..ec98b5e134f0 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -816,10 +816,11 @@ intel_crt_detect(struct drm_connector *connector,
 		else
 			status = connector_status_unknown;
 		intel_release_load_detect_pipe(connector, &tmp, ctx);
-	} else if (ret == 0)
+	} else if (ret == 0) {
 		status = connector_status_unknown;
-	else if (ret < 0)
+	} else {
 		status = ret;
+	}
 
 out:
 	intel_display_power_put(dev_priv, intel_encoder->power_domain);
-- 
2.15.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH] drm/i915/crt: Silence compiler warning for uninitialised status
@ 2018-02-08 16:39 Chris Wilson
  2018-02-08 17:26 ` ✓ Fi.CI.BAT: success for drm/i915/crt: Silence compiler warning for uninitialised status (rev2) Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2018-02-08 16:39 UTC (permalink / raw)
  To: intel-gfx

clang is confused by our if-else-chain that abruptly exits before a
final else:

drivers/gpu/drm/i915/intel_crt.c:821:11: warning: variable 'status' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        else if (ret < 0)
                 ^~~~~~~
drivers/gpu/drm/i915/intel_crt.c:826:9: note: uninitialized use occurs here
        return status;
               ^~~~~~
drivers/gpu/drm/i915/intel_crt.c:821:7: note: remove the 'if' if its condition is always true
        else if (ret < 0)
             ^~~~~~~~~~~~
drivers/gpu/drm/i915/intel_crt.c:761:12: note: initialize the variable 'status' to silence this warning
        int status, ret;

In this case, we can reduce the final else-if clause to an unconditional
else.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_crt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 1cd4a7c22bd5..d1493ced16f8 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -807,10 +807,11 @@ intel_crt_detect(struct drm_connector *connector,
 		else
 			status = connector_status_unknown;
 		intel_release_load_detect_pipe(connector, &tmp, ctx);
-	} else if (ret == 0)
+	} else if (ret == 0) {
 		status = connector_status_unknown;
-	else if (ret < 0)
+	} else {
 		status = ret;
+	}
 
 out:
 	intel_display_power_put(dev_priv, intel_encoder->power_domain);
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for drm/i915/crt: Silence compiler warning for uninitialised status (rev2)
  2018-02-08 16:39 [PATCH] drm/i915/crt: Silence compiler warning for uninitialised status Chris Wilson
@ 2018-02-08 17:26 ` Patchwork
  2018-02-08 17:53 ` [PATCH] drm/i915/crt: Silence compiler warning for uninitialised status Ville Syrjälä
  2018-02-09  1:33 ` ✓ Fi.CI.IGT: success for drm/i915/crt: Silence compiler warning for uninitialised status (rev2) Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-02-08 17:26 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/crt: Silence compiler warning for uninitialised status (rev2)
URL   : https://patchwork.freedesktop.org/series/33365/
State : success

== Summary ==

Series 33365v2 drm/i915/crt: Silence compiler warning for uninitialised status
https://patchwork.freedesktop.org/api/1.0/series/33365/revisions/2/mbox/

Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-b-frame-sequence:
                fail       -> PASS       (fi-skl-6700k2) fdo#103191
        Subgroup suspend-read-crc-pipe-b:
                pass       -> INCOMPLETE (fi-snb-2520m) fdo#103713

fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:418s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:420s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:375s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:494s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:289s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:478s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:484s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:470s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:452s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:572s
fi-cnl-y3        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:573s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:416s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:285s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:514s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:387s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:412s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:457s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:416s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:463s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:498s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:454s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:502s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:597s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:428s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:505s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:530s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:485s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:484s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:414s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:429s
fi-snb-2520m     total:245  pass:211  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:392s
Blacklisted hosts:
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:469s

39f806d9a6cb7e5bb15fab499445525babed99ef drm-tip: 2018y-02m-08d-16h-07m-34s UTC integration manifest
920930c57d11 drm/i915/crt: Silence compiler warning for uninitialised status

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7958/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915/crt: Silence compiler warning for uninitialised status
  2018-02-08 16:39 [PATCH] drm/i915/crt: Silence compiler warning for uninitialised status Chris Wilson
  2018-02-08 17:26 ` ✓ Fi.CI.BAT: success for drm/i915/crt: Silence compiler warning for uninitialised status (rev2) Patchwork
@ 2018-02-08 17:53 ` Ville Syrjälä
  2018-02-09  1:33 ` ✓ Fi.CI.IGT: success for drm/i915/crt: Silence compiler warning for uninitialised status (rev2) Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Ville Syrjälä @ 2018-02-08 17:53 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Thu, Feb 08, 2018 at 04:39:39PM +0000, Chris Wilson wrote:
> clang is confused by our if-else-chain that abruptly exits before a
> final else:
> 
> drivers/gpu/drm/i915/intel_crt.c:821:11: warning: variable 'status' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>         else if (ret < 0)
>                  ^~~~~~~
> drivers/gpu/drm/i915/intel_crt.c:826:9: note: uninitialized use occurs here
>         return status;
>                ^~~~~~
> drivers/gpu/drm/i915/intel_crt.c:821:7: note: remove the 'if' if its condition is always true
>         else if (ret < 0)
>              ^~~~~~~~~~~~
> drivers/gpu/drm/i915/intel_crt.c:761:12: note: initialize the variable 'status' to silence this warning
>         int status, ret;
> 
> In this case, we can reduce the final else-if clause to an unconditional
> else.

Makes me wonder a bit if clang has any sort of range analysis pass.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_crt.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 1cd4a7c22bd5..d1493ced16f8 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -807,10 +807,11 @@ intel_crt_detect(struct drm_connector *connector,
>  		else
>  			status = connector_status_unknown;
>  		intel_release_load_detect_pipe(connector, &tmp, ctx);
> -	} else if (ret == 0)
> +	} else if (ret == 0) {
>  		status = connector_status_unknown;
> -	else if (ret < 0)
> +	} else {
>  		status = ret;
> +	}
>  
>  out:
>  	intel_display_power_put(dev_priv, intel_encoder->power_domain);
> -- 
> 2.16.1

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.IGT: success for drm/i915/crt: Silence compiler warning for uninitialised status (rev2)
  2018-02-08 16:39 [PATCH] drm/i915/crt: Silence compiler warning for uninitialised status Chris Wilson
  2018-02-08 17:26 ` ✓ Fi.CI.BAT: success for drm/i915/crt: Silence compiler warning for uninitialised status (rev2) Patchwork
  2018-02-08 17:53 ` [PATCH] drm/i915/crt: Silence compiler warning for uninitialised status Ville Syrjälä
@ 2018-02-09  1:33 ` Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-02-09  1:33 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/crt: Silence compiler warning for uninitialised status (rev2)
URL   : https://patchwork.freedesktop.org/series/33365/
State : success

== Summary ==

Test kms_vblank:
        Subgroup pipe-a-ts-continuation-dpms-suspend:
                skip       -> PASS       (shard-snb)
Test kms_cursor_legacy:
        Subgroup cursor-vs-flip-legacy:
                fail       -> PASS       (shard-apl) fdo#103355
Test kms_cursor_crc:
        Subgroup cursor-256x256-suspend:
                incomplete -> PASS       (shard-hsw) fdo#103375 +1
Test kms_plane_lowres:
        Subgroup pipe-b-tiling-none:
                pass       -> FAIL       (shard-apl) fdo#103166
Test kms_flip:
        Subgroup 2x-plain-flip-fb-recreate:
                fail       -> PASS       (shard-hsw) fdo#100368
        Subgroup dpms-vs-vblank-race:
                fail       -> PASS       (shard-hsw) fdo#103060
Test drv_suspend:
        Subgroup debugfs-reader:
                skip       -> PASS       (shard-snb) fdo#102365
Test gem_eio:
        Subgroup in-flight:
                pass       -> FAIL       (shard-hsw) fdo#104676
Test drv_selftest:
        Subgroup live_gtt:
                pass       -> INCOMPLETE (shard-apl) fdo#103927

fdo#103355 https://bugs.freedesktop.org/show_bug.cgi?id=103355
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#104676 https://bugs.freedesktop.org/show_bug.cgi?id=104676
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927

shard-apl        total:3332 pass:1713 dwarn:1   dfail:0   fail:21  skip:1594 time:11933s
shard-hsw        total:3444 pass:1760 dwarn:1   dfail:0   fail:11  skip:1671 time:11837s
shard-snb        total:3444 pass:1351 dwarn:1   dfail:0   fail:9   skip:2083 time:6606s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7958/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2018-02-09  1:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-08 16:39 [PATCH] drm/i915/crt: Silence compiler warning for uninitialised status Chris Wilson
2018-02-08 17:26 ` ✓ Fi.CI.BAT: success for drm/i915/crt: Silence compiler warning for uninitialised status (rev2) Patchwork
2018-02-08 17:53 ` [PATCH] drm/i915/crt: Silence compiler warning for uninitialised status Ville Syrjälä
2018-02-09  1:33 ` ✓ Fi.CI.IGT: success for drm/i915/crt: Silence compiler warning for uninitialised status (rev2) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2017-11-07 18:46 [PATCH] drm/i915/crt: Silence compiler warning for uninitialised status Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox