dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915/display: fix uninitialized variable
@ 2020-08-25 23:20 trix
  2020-08-29  1:10 ` Souza, Jose
  0 siblings, 1 reply; 2+ messages in thread
From: trix @ 2020-08-25 23:20 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied, daniel,
	jose.souza, matthew.d.roper, anusha.srivatsa,
	pankaj.laxminarayan.bharadiya, wambui.karugax, vivek.kasireddy
  Cc: Tom Rix, intel-gfx, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

clang static analysis flags this error

intel_combo_phy.c:268:7: warning: The left expression of the
  compound assignment is an uninitialized value.
  The computed value will also be garbage
                ret &= check_phy_reg(...
                ~~~ ^

ret has no initial values, in icl_combo_phy_verify_state() ret is
set by the next statment and then updated by similar &= logic.

Because the check_phy_req() are only register reads, reorder the
statements.

Fixes: 239bef676d8e ("drm/i915/display: Implement new combo phy initialization step")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/i915/display/intel_combo_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_combo_phy.c b/drivers/gpu/drm/i915/display/intel_combo_phy.c
index 6968de4f3477..7622ef66c987 100644
--- a/drivers/gpu/drm/i915/display/intel_combo_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_combo_phy.c
@@ -264,6 +264,8 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
 	if (!icl_combo_phy_enabled(dev_priv, phy))
 		return false;
 
+	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
+
 	if (INTEL_GEN(dev_priv) >= 12) {
 		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_TX_DW8_LN0(phy),
 				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
@@ -276,8 +278,6 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
 				     DCC_MODE_SELECT_CONTINUOSLY);
 	}
 
-	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
-
 	if (phy_is_master(dev_priv, phy)) {
 		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_COMP_DW8(phy),
 				     IREFGEN, IREFGEN);
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/i915/display: fix uninitialized variable
  2020-08-25 23:20 [PATCH] drm/i915/display: fix uninitialized variable trix
@ 2020-08-29  1:10 ` Souza, Jose
  0 siblings, 0 replies; 2+ messages in thread
From: Souza, Jose @ 2020-08-29  1:10 UTC (permalink / raw)
  To: airlied, Vivi, Rodrigo, Roper, Matthew D, joonas.lahtinen,
	Srivatsa, Anusha, Laxminarayan Bharadiya, Pankaj, trix,
	wambui.karugax, daniel, jani.nikula, Kasireddy, Vivek
  Cc: intel-gfx, linux-kernel, dri-devel

Just merged the first patch that fixed this issue, thanks anyways.

2034c2129bc4a91d471815d4dc7a2a69eaa5338d - drm/i915/display: Ensure that ret is always initialized in icl_combo_phy_verify_state


On Tue, 2020-08-25 at 16:20 -0700, trix@redhat.com wrote:
> From: Tom Rix <
> trix@redhat.com
> >
> 
> clang static analysis flags this error
> 
> intel_combo_phy.c:268:7: warning: The left expression of the
>   compound assignment is an uninitialized value.
>   The computed value will also be garbage
>                 ret &= check_phy_reg(...
>                 ~~~ ^
> 
> ret has no initial values, in icl_combo_phy_verify_state() ret is
> set by the next statment and then updated by similar &= logic.
> 
> Because the check_phy_req() are only register reads, reorder the
> statements.
> 
> Fixes: 239bef676d8e ("drm/i915/display: Implement new combo phy initialization step")
> Signed-off-by: Tom Rix <
> trix@redhat.com
> >
> ---
>  drivers/gpu/drm/i915/display/intel_combo_phy.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_combo_phy.c b/drivers/gpu/drm/i915/display/intel_combo_phy.c
> index 6968de4f3477..7622ef66c987 100644
> --- a/drivers/gpu/drm/i915/display/intel_combo_phy.c
> +++ b/drivers/gpu/drm/i915/display/intel_combo_phy.c
> @@ -264,6 +264,8 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
>  	if (!icl_combo_phy_enabled(dev_priv, phy))
>  		return false;
>  
> +	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
> +
>  	if (INTEL_GEN(dev_priv) >= 12) {
>  		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_TX_DW8_LN0(phy),
>  				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
> @@ -276,8 +278,6 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
>  				     DCC_MODE_SELECT_CONTINUOSLY);
>  	}
>  
> -	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
> -
>  	if (phy_is_master(dev_priv, phy)) {
>  		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_COMP_DW8(phy),
>  				     IREFGEN, IREFGEN);
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-08-29  1:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25 23:20 [PATCH] drm/i915/display: fix uninitialized variable trix
2020-08-29  1:10 ` Souza, Jose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).