Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp770484rwe; Fri, 26 Aug 2022 14:15:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR6AdfJAts7JaMVtryiMeQvL1SPRdvt+PdqrDcgALY7KR2Ksuq12DOUuGBuYj7w3l8dP5Cis X-Received: by 2002:a17:90b:4b4e:b0:1fb:3c38:28ea with SMTP id mi14-20020a17090b4b4e00b001fb3c3828eamr6450159pjb.131.1661548554950; Fri, 26 Aug 2022 14:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661548554; cv=none; d=google.com; s=arc-20160816; b=USfX2VebtUxh6x8j0ePpBYju9rZRoKh7Wu5Wewg3TAgfjfmmWvEIOLrRsbm06cGkfX 1dBGWGGzrDSwGGr5c6s0OQ7gOMAabQ3W5rSt5r99aj3Mo5jZdeBS/UUswi+loilKdKzB 6SKY10jzknvKqhFevoDStTHZDF9BYlElN/rewyFJYcn6MyLao4OGmHP+P9J1dbVfRmux t5MXfy0qYFj6kiYciVhBw1YSXdP2GqSfo4qaSpn8CtNCZwtN/aM5J1Xiq93KUlNXijy0 4c9+u/mQk/GZAagzULozd6poEUyUWh893o82zxvjpekeFrDJ8g8k0IClMJOYBWK2PQ8t 7PsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=dddmhs6+o4Xh9+N13zA/oRm8MafN5+Bs+QATExsKyJY=; b=JUIPcOIqqni6iCD0r2h0XzqzISypLP7prZ1HzPPNGDFgrKbJMeSLla9rJEqOuUmlTi jL2DUfX85CZYczixAc90+2UjsS/Sjme2d8XIyBf0LTzarBub1jxuhfPsJ4TdWsx6f/GC TVKnxGIyK/NoetB1gsq3SLQuzsdOXWLMITSD3LauEW4GJA0c+HnmjDf+ypZO7pL6/O85 JxgSIS8Bw8ljxNCgqFifTjEjucZa6TQuVzVLxG/FqcZC1BXQUXB/6Emz8p9bIvjret6E CMRVTEe8qPnY3O9UORO6+PjUMvV0vmfDH5zT8xmQfgi1FsvVRmIq6EFzrE5v3oB8fhEB lBQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hKBtKzMs; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bg16-20020a056a02011000b0041b557cea68si2783815pgb.25.2022.08.26.14.15.43; Fri, 26 Aug 2022 14:15:54 -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=@gmail.com header.s=20210112 header.b=hKBtKzMs; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344946AbiHZUjg (ORCPT + 99 others); Fri, 26 Aug 2022 16:39:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344914AbiHZUje (ORCPT ); Fri, 26 Aug 2022 16:39:34 -0400 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55FD4CC33E for ; Fri, 26 Aug 2022 13:39:33 -0700 (PDT) Received: by mail-oi1-x22c.google.com with SMTP id r10so3388626oie.1 for ; Fri, 26 Aug 2022 13:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=dddmhs6+o4Xh9+N13zA/oRm8MafN5+Bs+QATExsKyJY=; b=hKBtKzMs03S28uiZi6W8K8XZgK75JXvAxKo69eY/sQekyRhp1YDNE92qlzZ1RrAq3M QsDsiQB7qxj8u5WGLGJHEZN07uqx4uc0DTtu5I/rzwTBshwnXs6bsC5fraE+DzBgABfq lJf137qOxIx2CcV4CeSlhGUTvJUGsGWMiR+hC4BwUa4b2NwK/oVTNO2xok8F82P7n4Ep RxPpF7+nfDHOA1DhvwWcT2s2Vm11G62IR+Bl5ajoBGVZxYxGlU+DLmQ61DOgfjg35AOy zGeumYcJWLrbLg4asbyORIc7ded9kdzu0zs+lFpE60Shh652rk31pj+32mP95lMFUTfH idkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=dddmhs6+o4Xh9+N13zA/oRm8MafN5+Bs+QATExsKyJY=; b=otal6CPKzJaZWVwBa4heCwwZUJOml1e/ySs4H4qz2pm/55AIsaowQCz8dnD4tdjJlm zkL5wGsLtYZkBSmES9AHnW7ty5s6QQem6zc/zqqmw2p7UUAuLOnb5Cl5V4dMPO2oegIA B165SM2idL3RcuMjSubH3DjnDDbL0C1cXX3gMPu9aw/dMzf5QDsqgyOL+W6HvJM801WE GqCtJt7EaQhPh/F9W03n5ZljpoktnIIUDBdu6XE8lEtotn/5V1Yll8U0UDrhgP0QqKs7 P9sDoEpYQpCY53Exnpec7d1Q+SHA6SDymS7djJ4tMx5KZwvETmRI17Vova/7GY7hXNL0 wwKw== X-Gm-Message-State: ACgBeo3oZwbftI1mvTJvERbCTD2V7vNEC2uN7qzV98o0NsansYIDl/ER rOJK1rFlzFgDWqaC2iT7vc2kSIihhonxBzyttsA= X-Received: by 2002:a05:6808:2187:b0:344:eccd:3fc5 with SMTP id be7-20020a056808218700b00344eccd3fc5mr2542948oib.46.1661546372683; Fri, 26 Aug 2022 13:39:32 -0700 (PDT) MIME-Version: 1.0 References: <20220826084121.94319-1-sunliming@kylinos.cn> In-Reply-To: <20220826084121.94319-1-sunliming@kylinos.cn> From: Alex Deucher Date: Fri, 26 Aug 2022 16:39:21 -0400 Message-ID: Subject: Re: [PATCH] drm/amd/display: Fix variable dereferenced before check To: sunliming Cc: Rodrigo.Siqueira@amd.com, alexander.deucher@amd.com, airlied@linux.ie, daniel@ffwll.ch, kernel test robot , kelulanainsley@gmail.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Dan Carpenter Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Applied. Thanks! Alex On Fri, Aug 26, 2022 at 4:41 AM sunliming 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 > Reported-by: Dan Carpenter > Signed-off-by: sunliming > --- > 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 >