[bug report] drm/amd/display: Add support for Freesync 2 HDR and Content to Display Mapping

Dan Carpenter dan.carpenter at oracle.com
Fri Nov 23 09:27:04 UTC 2018


Hello SivapiriyanKumarasamy,

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

The patch e1e8a020c6b8: "drm/amd/display: Add support for Freesync 2 
HDR and Content to Display Mapping" from Sep 11, 2018, leads to the 
following Smatch complaint:

    drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c:826 build_freesync_hdr()
     warn: variable dereferenced before check 'fs_params' (see line 816)

drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c
   815		struct fixed31_32 scaledX1 = dc_fixpt_zero;
   816		struct fixed31_32 max_display = dc_fixpt_from_int(fs_params->max_display);
                                                                   ^^^^^^^^^^^^^^^^^^^^^
   817		struct fixed31_32 min_display = dc_fixpt_from_fraction(fs_params->min_display, 10000);
                                                                        ^^^^^^^^^^^^^^^^^^^^^
   818		struct fixed31_32 max_content = dc_fixpt_from_int(fs_params->max_content);
   819		struct fixed31_32 min_content = dc_fixpt_from_fraction(fs_params->min_content, 10000);
   820		struct fixed31_32 clip = dc_fixpt_one;
   821		struct fixed31_32 output;
   822		bool use_eetf = false;
   823		bool is_clipped = false;
   824		struct fixed31_32 sdr_white_level = dc_fixpt_from_int(fs_params->sdr_white_level);
   825	
   826		if (fs_params == NULL || fs_params->max_content == 0 ||
                    ^^^^^^^^^^^^^^^^^
Too late.

   827				fs_params->max_display == 0)
   828			return false;

regards,
dan carpenter


More information about the amd-gfx mailing list