From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/i915/crt: Silence compiler warning for uninitialised status
Date: Wed, 15 Nov 2017 14:48:33 +0200 [thread overview]
Message-ID: <20171115124833.GA10981@intel.com> (raw)
In-Reply-To: <20171115105036.1094-4-chris@chris-wilson.co.uk>
On Wed, Nov 15, 2017 at 10:50:36AM +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.
>
> 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 9f31aea51dff..ae55afcbdc2c 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -810,10 +810,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;
> + }
Patch lgtm
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
On a somewhat related note, the return value of intel_get_load_detect_pipe()
is quite a mess. It's mixing ints and bools in a way that makes the whole
thing look very confusing. In the end it looks like like -EDEADLK is the
only error we can get here.
>
> out:
> intel_display_power_put(dev_priv, intel_encoder->power_domain);
> --
> 2.15.0
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-11-15 12:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-15 10:50 Trivial compiler squelching Chris Wilson
2017-11-15 10:50 ` [PATCH 1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers Chris Wilson
2017-11-15 12:50 ` Ville Syrjälä
2017-11-15 13:17 ` [PATCH v2] " Chris Wilson
2017-11-15 13:24 ` Ville Syrjälä
2017-11-17 13:32 ` Wang, Zhi A
2017-11-20 9:54 ` Joonas Lahtinen
2017-11-20 10:02 ` Wang, Zhi A
2017-11-15 10:50 ` [PATCH 2/3] drm/i915/: Initialise trans_min for skl_compute_transition_wm() Chris Wilson
2017-11-15 10:54 ` Chris Wilson
2017-11-16 1:12 ` Rodrigo Vivi
2018-01-22 19:13 ` Chris Wilson
2018-02-19 20:41 ` Chris Wilson
2017-11-15 10:50 ` [PATCH 3/3] drm/i915/crt: Silence compiler warning for uninitialised status Chris Wilson
2017-11-15 12:48 ` Ville Syrjälä [this message]
2017-11-15 11:14 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers Patchwork
2017-11-15 12:08 ` ✓ Fi.CI.IGT: " Patchwork
2017-11-15 13:34 ` ✓ Fi.CI.BAT: success for series starting with [v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers (rev2) Patchwork
2017-11-15 14:27 ` ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171115124833.GA10981@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.