Skip to contentSkip to conversation

drm/amd/display: Do full modeset when DSC debugfs is changed

bug report Dan Carpenter 2 participants 2 messages Dec 4, 2020 – Dec 8, 2020

lore
Share & tools
lore
#0 lore raw

Hello Eryk Brol,

This is a semi-automatic email about new static checker warnings.

The patch 115a385c08d8: "drm/amd/display: Do full modeset when DSC debugfs is changed" from Nov 19, 2020, leads to the following Smatch complaint:

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9335 amdgpu_dm_atomic_check()
warn: variable dereferenced before check 'new_crtc_state' (see line 9318)

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c
9317
9318 if (!drm_atomic_crtc_needs_modeset(new_crtc_state) &&
9319 !new_crtc_state->color_mgmt_changed &&
9320 old_crtc_state->vrr_enabled == new_crtc_state->vrr_enabled &&
9321 dm_old_crtc_state->dsc_force_changed == false)
9322 continue;
9323
9324 if (!new_crtc_state->enable)

                             ^^^^^^^^^^^^^^^^^^^^^^

This is already dereferenced

9325 continue;
9326
9327 ret = drm_atomic_add_affected_connectors(state, crtc);
9328 if (ret)
9329 return ret;
9330
9331 ret = drm_atomic_add_affected_planes(state, crtc);
9332 if (ret)
9333 goto fail;
9334
9335 if (dm_old_crtc_state->dsc_force_changed && new_crtc_state)

                                                                    ^^^^^^^^^^^^^^

So hopefully this NULL check can be removed?

  9336				new_crtc_state->mode_changed = true;
  9337		}

regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#1 lore raw

[AMD Official Use Only - Internal Distribution Only]

Hi Dan,

Thanks for catching this!
I've removed the extra NULL check as it's not needed.

Cheers,
Eryk Brol
________________________________
From: Dan Carpenter <[email protected]>
Sent: Friday, December 4, 2020 10:18 AM
To: Brol, Eryk <[email protected]>
Cc: [email protected] <[email protected]>
Subject: [bug report] drm/amd/display: Do full modeset when DSC debugfs is changed

Hello Eryk Brol,

This is a semi-automatic email about new static checker warnings.

The patch 115a385c08d8: "drm/amd/display: Do full modeset when DSC debugfs is changed" from Nov 19, 2020, leads to the following Smatch complaint:

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9335 amdgpu_dm_atomic_check()
warn: variable dereferenced before check 'new_crtc_state' (see line 9318)

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c
9317
9318 if (!drm_atomic_crtc_needs_modeset(new_crtc_state) &&
9319 !new_crtc_state->color_mgmt_changed &&
9320 old_crtc_state->vrr_enabled == new_crtc_state->vrr_enabled &&
9321 dm_old_crtc_state->dsc_force_changed == false)
9322 continue;
9323
9324 if (!new_crtc_state->enable)

                             ^^^^^^^^^^^^^^^^^^^^^^

This is already dereferenced

9325 continue;
9326
9327 ret = drm_atomic_add_affected_connectors(state, crtc);
9328 if (ret)
9329 return ret;
9330
9331 ret = drm_atomic_add_affected_planes(state, crtc);
9332 if (ret)
9333 goto fail;
9334
9335 if (dm_old_crtc_state->dsc_force_changed && new_crtc_state)

                                                                    ^^^^^^^^^^^^^^

So hopefully this NULL check can be removed?

  9336                          new_crtc_state->mode_changed = true;
  9337          }

regards,
dan carpenter

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