[Intel-gfx] [bug report] drm/i915/dmc: add i915_to_dmc() and dmc->i915 and use them
Jani Nikula
jani.nikula at intel.com
Thu Mar 9 14:51:10 UTC 2023
On Thu, 09 Mar 2023, Dan Carpenter <error27 at gmail.com> wrote:
> Hello Jani Nikula,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 1b28c1c789d0: "drm/i915/dmc: add i915_to_dmc() and
> dmc->i915 and use them" from Mar 1, 2023, leads to the following
> Smatch complaint:
>
> drivers/gpu/drm/i915/display/intel_dmc.c:1162 intel_dmc_debugfs_status_show()
> error: we previously assumed 'dmc' could be null (see line 1148)
>
> drivers/gpu/drm/i915/display/intel_dmc.c
> 1142
> 1143 wakeref = intel_runtime_pm_get(&i915->runtime_pm);
> 1144
> 1145 seq_printf(m, "DMC initialized: %s\n", str_yes_no(dmc));'
> ^^^^^^^^^^^^^^^
> This is a check for NULL too.
>
> 1146 seq_printf(m, "fw loaded: %s\n",
> 1147 str_yes_no(intel_dmc_has_payload(i915)));
> 1148 seq_printf(m, "path: %s\n", dmc ? dmc->fw_path : "N/A");
> ^^^
> The patch adds a check for NULL.
>
> 1149 seq_printf(m, "Pipe A fw needed: %s\n",
> 1150 str_yes_no(GRAPHICS_VER(i915) >= 12));
> 1151 seq_printf(m, "Pipe A fw loaded: %s\n",
> 1152 str_yes_no(has_dmc_id_fw(i915, DMC_FW_PIPEA)));
> 1153 seq_printf(m, "Pipe B fw needed: %s\n",
> 1154 str_yes_no(IS_ALDERLAKE_P(i915) ||
> 1155 DISPLAY_VER(i915) >= 14));
> 1156 seq_printf(m, "Pipe B fw loaded: %s\n",
> 1157 str_yes_no(has_dmc_id_fw(i915, DMC_FW_PIPEB)));
> 1158
> 1159 if (!intel_dmc_has_payload(i915))
intel_dmc_has_payload() should always return false for dmc == NULL.
BR,
Jani.
> 1160 goto out;
> 1161
> 1162 seq_printf(m, "version: %d.%d\n", DMC_VERSION_MAJOR(dmc->version),
> ^^^^^^^^^^^^
> 1163 DMC_VERSION_MINOR(dmc->version));
> ^^^^^^^^^^^^
> Unchecked dereferences.
>
> 1164
>
> regards,
> dan carpenter
--
Jani Nikula, Intel Open Source Graphics Center
More information about the Intel-gfx
mailing list