Skip to contentSkip to conversation

drm/i915/display: fix uninitialized variable

PATCH In review [email protected] 3 participants 3 messages Aug 25, 2020 – Aug 29, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/display: fix uninitialized variable

From: Tom Rix <[email protected]>

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")
---
 drivers/gpu/drm/i915/display/intel_combo_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_combo_phy.c +2 -2
index 6968de4f3477..7622ef66c987 100644
@@ -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);
Signature · 6 lines
2.18.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/display: fix uninitialized variable

== Series Details ==

== Series Details ==

Series: drm/i915/display: fix uninitialized variable
URL : https://patchwork.freedesktop.org/series/80998/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_8924 -> Patchwork_18402
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_18402 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_18402, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18402/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_18402:

### IGT changes ###

#### Possible regressions ####

* igt@runner@aborted:
- fi-kbl-7500u: NOTRUN -> [FAIL][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18402/fi-kbl-7500u/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_18402 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_flip@basic-flip-vs-wf_vblank@c-edp1:
- fi-icl-u2: [PASS][2] -> [DMESG-WARN][3] ([i915#1982])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8924/fi-icl-u2/igt@kms_flip@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18402/fi-icl-u2/igt@kms_flip@[email protected]

#### Possible fixes ####

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-byt-j1900: [DMESG-WARN][4] ([i915#1982]) -> [PASS][5] +1 similar issue
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8924/fi-byt-j1900/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18402/fi-byt-j1900/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- fi-icl-u2: [DMESG-WARN][6] ([i915#1982]) -> [PASS][7]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8924/fi-icl-u2/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18402/fi-icl-u2/igt@[email protected]

* igt@kms_flip@basic-flip-vs-wf_vblank@c-hdmi-a2:
- fi-skl-guc: [DMESG-WARN][8] ([i915#2203]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8924/fi-skl-guc/igt@kms_flip@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18402/fi-skl-guc/igt@kms_flip@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-apl-guc: [INCOMPLETE][10] ([i915#1635] / [i915#337]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8924/fi-apl-guc/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18402/fi-apl-guc/igt@[email protected]

#### Warnings ####

* igt@i915_pm_rpm@module-reload:
- fi-kbl-x1275: [DMESG-FAIL][12] ([i915#62] / [i915#95]) -> [DMESG-FAIL][13] ([i915#62])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8924/fi-kbl-x1275/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18402/fi-kbl-x1275/igt@[email protected]

* igt@kms_flip@basic-flip-vs-modeset@a-dp1:
- fi-kbl-x1275: [DMESG-WARN][14] ([i915#62] / [i915#92]) -> [DMESG-WARN][15] ([i915#62] / [i915#92] / [i915#95]) +3 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8924/fi-kbl-x1275/igt@kms_flip@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18402/fi-kbl-x1275/igt@kms_flip@[email protected]

* igt@kms_force_connector_basic@force-edid:
- fi-kbl-x1275: [DMESG-WARN][16] ([i915#62] / [i915#92] / [i915#95]) -> [DMESG-WARN][17] ([i915#62] / [i915#92]) +2 similar issues
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8924/fi-kbl-x1275/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18402/fi-kbl-x1275/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#1635]: https://gitlab.freedesktop.org/drm/intel/issues/1635
[i915#1814]: https://gitlab.freedesktop.org/drm/intel/issues/1814
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2203]: https://gitlab.freedesktop.org/drm/intel/issues/2203
[i915#2335]: https://gitlab.freedesktop.org/drm/intel/issues/2335
[i915#337]: https://gitlab.freedesktop.org/drm/intel/issues/337
[i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
[i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95

Participating hosts (37 -> 34)
------------------------------

Missing (3): fi-byt-clapper fi-byt-squawks fi-bsw-cyan

Build changes
-------------

* Linux: CI_DRM_8924 -> Patchwork_18402

CI-20190529: 20190529
CI_DRM_8924: a8c0611e412aab46eab5475b0117d074892b96e2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5770: f1d0c240ea2e631dfb9f493f37f8fb61cb2b1cf2 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_18402: 18a3251e6ae59f22d3ea7ee661075cc42b53cac5 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

18a3251e6ae5 drm/i915/display: fix uninitialized variable

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18402/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to [email protected]

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

Quoted 41 lines · On Tue, 2020-08-25 at 16:20 -0700, [email protected] wrote:

From: Tom Rix <
[email protected]

Quoted 1 line

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 <

[email protected]

Quoted 1 line
---
 drivers/gpu/drm/i915/display/intel_combo_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_combo_phy.c +2 -0
index 6968de4f3477..7622ef66c987 100644
@@ -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 |

drivers/gpu/drm/i915/display/intel_combo_phy.c static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, · line 283

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +0 -2
@@ -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);

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx