[bug report] drm/amd/display: switch DC over to the new DRM logging macros

Dan Carpenter dan.carpenter at linaro.org
Thu Sep 28 07:05:41 UTC 2023


Hello Hamza Mahfooz,

The patch 5d72e247e58c: "drm/amd/display: switch DC over to the new
DRM logging macros" from Sep 20, 2023 (linux-next), leads to the
following Smatch static checker warning:

	drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c:542 dm_helpers_dp_read_dpcd()
	error: we previously assumed 'aconnector' could be null (see line 541)

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c
    531 bool dm_helpers_dp_read_dpcd(
    532                 struct dc_context *ctx,
    533                 const struct dc_link *link,
    534                 uint32_t address,
    535                 uint8_t *data,
    536                 uint32_t size)
    537 {
    538 
    539         struct amdgpu_dm_connector *aconnector = link->priv;
    540 
    541         if (!aconnector) {
                     ^^^^^^^^^^
Check for NULL

--> 542                 drm_dbg_dp(aconnector->base.dev,
                                   ^^^^^^^^^^^^^^^^^^^^
NULL dereference.

    543                            "Failed to find connector for link!\n");
    544                 return false;
    545         }
    546 
    547         return drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address, data,
    548                                 size) == size;
    549 }

regards,
dan carpenter


More information about the amd-gfx mailing list