Hi,

On 17/05/23 5:07 pm, Tom Chung wrote:
From: Aurabindo Pillai <aurabindo.pil...@amd.com>

[Why&How]
Change how DC version and hardware version is printed when driver is
loaded.

- Remove exclamation
- Add DC version and hardware version to both success and failure cases
- Add version in between appropriate filler words to make a complete
   statement.

Reviewed-by: Harry Wentland <harry.wentl...@amd.com>
Acked-by: Tom Chung <chiahsuan.ch...@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pil...@amd.com>
---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 14b296e1d0f6..45b778631430 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1666,10 +1666,11 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
        adev->dm.dc = dc_create(&init_data);
if (adev->dm.dc) {

        // Check for NULL
-               DRM_INFO("Display Core initialized with v%s! %s\n", DC_VER,
+               DRM_INFO("Display Core v%s initialized on %s\n", DC_VER,
                         dce_version_to_string(adev->dm.dc->ctx->dce_version));
        } else {
        // adev->dm.dc is NULL here

-               DRM_INFO("Display Core failed to initialize with v%s!\n", 
DC_VER);
+               DRM_INFO("Display Core v%s failed to initialize on %s\n", 
DC_VER,
+                        dce_version_to_string(adev->dm.dc->ctx->dce_version)); 
                                                      ^^^^NULL deref bug here.

I found this using static analysis with smatch.

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1673 amdgpu_dm_init() error: we previously assumed 'adev->dm.dc' could be null (see line 1669)

If you fix this could you please consider adding:

Reported-by: Harshit Mogalapalli <harshit.m.mogalapa...@oracle.com>

Thanks,
Harshit
                                                                                
                                
                                        
                goto error;
        }

Reply via email to