[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_O2WoDxCJG0rx_x1VhqVHxDT8Aa-X1h+5XwPALiO=8qOA@mail.gmail.com>
Date: Fri, 26 Aug 2022 16:39:21 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: sunliming <sunliming@...inos.cn>
Cc: Rodrigo.Siqueira@....com, alexander.deucher@....com,
airlied@...ux.ie, daniel@...ll.ch,
kernel test robot <lkp@...el.com>, kelulanainsley@...il.com,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
amd-gfx@...ts.freedesktop.org,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH] drm/amd/display: Fix variable dereferenced before check
Applied. Thanks!
Alex
On Fri, Aug 26, 2022 at 4:41 AM sunliming <sunliming@...inos.cn> wrote:
>
> Fixes the following smatch warning:
>
> drivers/gpu/drm/amd/amdgpu/../display/dc/dc_dmub_srv.c:311 dc_dmub_srv_p_state_delegate()
> warn: variable dereferenced before check 'dc' (see line 309)
>
> Reported-by: kernel test robot <lkp@...el.com>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: sunliming <sunliming@...inos.cn>
> ---
> drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
> index 09b304507bad..ebf99e8f93e0 100644
> --- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
> +++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
> @@ -323,11 +323,13 @@ bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool should_manage_pstate, stru
> struct dmub_cmd_fw_assisted_mclk_switch_config *config_data = &cmd.fw_assisted_mclk_switch.config_data;
> int i = 0;
> int ramp_up_num_steps = 1; // TODO: Ramp is currently disabled. Reenable it.
> - uint8_t visual_confirm_enabled = dc->debug.visual_confirm == VISUAL_CONFIRM_FAMS;
> + uint8_t visual_confirm_enabled;
>
> if (dc == NULL)
> return false;
>
> + visual_confirm_enabled = dc->debug.visual_confirm == VISUAL_CONFIRM_FAMS;
> +
> // Format command.
> cmd.fw_assisted_mclk_switch.header.type = DMUB_CMD__FW_ASSISTED_MCLK_SWITCH;
> cmd.fw_assisted_mclk_switch.header.sub_type = DMUB_CMD__FAMS_SETUP_FW_CTRL;
> --
> 2.25.1
>
Powered by blists - more mailing lists