[Intel-gfx] [bug report] drm/i915/dmc: add i915_to_dmc() and dmc->i915 and use them
Jani Nikula
jani.nikula at intel.com
Fri Mar 10 16:36:04 UTC 2023
On Fri, 10 Mar 2023, Dan Carpenter <error27 at gmail.com> wrote:
> On Thu, Mar 09, 2023 at 04:51:10PM +0200, Jani Nikula wrote:
>> 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.
>
> Ah, right. Sorry for the noise. I'm going to try figure out how to
> make Smatch parse this correctly.
No worries. I did wonder while writing the patch whether it would throw
off people, didn't even consider static analysis. :)
BR,
Jani.
--
Jani Nikula, Intel Open Source Graphics Center
More information about the Intel-gfx
mailing list