Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp877118rwi; Wed, 19 Oct 2022 04:12:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4knRJSX/QCulW6fv973CaAjBsRVQunwDMJJlTl/QCALj3WPkhDPjCXwfSIq5l3z7ru2CGV X-Received: by 2002:a17:903:454:b0:184:dc78:563d with SMTP id iw20-20020a170903045400b00184dc78563dmr7836797plb.41.1666177953985; Wed, 19 Oct 2022 04:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177953; cv=none; d=google.com; s=arc-20160816; b=PCo+7VwlONjBIsK4DYYS6OH7wfLpy3DvVWU5oQrFKuF0HI18ITVZ2Pgc+IjhTm16jp VAiw2ZLgbNgr0/DNCyV39i0O8jtVjaexoM+wFTeK8KJjh8wNWoaZynllwLxiPGGt7j/0 S6HMEGvcjaakg0lO9bzfFOICw8ANJqcSBYjV5Ua4JdgEr+L/4SdIJGkmWiyvTpt857SR 1pAccRmvh9QqZPKMVj2CFRaH2hAdGIMDLW3e3Q75vz4zGC7uUnBGYf6fhBoLmrVeZ5w+ DwZ5JKIq1HrarwY1pZQzkDreCabeUfdT09Oxa+/xJsJpo1PXRWq+dNaq2ERFCa/cW4kZ oh9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eZ5tWk8r58wmiNTJursBVehRVzi9Ftw3XX052CENwKw=; b=SuTwTP+4DlhDMHNEkBNCdiUo/4HmwMUkzvI/85RBTaM2g/h0sZnP9qYhO0mpO6f08I DmlBgDEZNHMVgZPM+gaP39RS0YppgxNa7lhDvC4AjQCZtgmnNJyXk7L3ENyaxAl+ksTY uOgYk75H/i5+VhgrUNKwNCBxXseZ5Yhp+ohGTR0oij1WtXdrdh5ryuSIf1ofBxiKpfMo m9m8sSYu16z7hCDWjhsrln2pLW0VZmDf3bhQV0eEcKXAIfWEWwFVn27OrKzXP6JquZRo xodYm7s7VZ07mS/gT4WEb9lUgc9f91OJyktaN1Dxm2fWPGL/rURUqRrkyqquUmlYVswt Jhrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qCprGu7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x70-20020a638649000000b00458085e9e70si17649753pgd.577.2022.10.19.04.12.20; Wed, 19 Oct 2022 04:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qCprGu7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234717AbiJSK5C (ORCPT + 99 others); Wed, 19 Oct 2022 06:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234677AbiJSK4J (ORCPT ); Wed, 19 Oct 2022 06:56:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C942B76756; Wed, 19 Oct 2022 03:27:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 41D96B824C1; Wed, 19 Oct 2022 09:11:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2C18C433D7; Wed, 19 Oct 2022 09:11:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170666; bh=pP8jj1BLaAqsUYAH8uUEPMkH+VEo8jVb7LcvIKD0S1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qCprGu7Ba2xwEjihypSobcR9TNEKpi8lspjLhQqW5xNj7ShbK5+2o1IxaKXQrb9ZZ MvJJ/soMtByPPiZa/YGucilwDQnUwoqEI/f3uJ2i7AA6B0ypJTR7MLXhqPw6QdSVRz 00CLQJQRCdo1F96LcUJXxYJYyXCOn3NGIrdYYDBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , sunliming , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 740/862] drm/amd/display: Fix variable dereferenced before check Date: Wed, 19 Oct 2022 10:33:47 +0200 Message-Id: <20221019083322.652970141@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: sunliming [ Upstream commit 45a92f45f4578ff89da7dc5ef50bab4ef870f3b7 ] 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 Reported-by: Dan Carpenter Signed-off-by: sunliming Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- 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 76c05ff12e95..755c4f9de6da 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.35.1