Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2017469pxb; Mon, 22 Feb 2021 17:53:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1FrccRImbZZed5v2sbcyFTC0RnUD1jOgp33AOl5gJeKKhSxBcdGMOqYGjfuuM73olHcWx X-Received: by 2002:a17:906:2e91:: with SMTP id o17mr20401729eji.488.1614045201383; Mon, 22 Feb 2021 17:53:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614045201; cv=none; d=google.com; s=arc-20160816; b=YxBPupXZ5MpMUWXH4q272yzebht3VtWyBsoegSwcKK8Zmem+UORO7h+viBxc3AkuJH MbV9ads6JD2lCWHn8v9+H74o0pflHUC0hG0Jok9VgCXH8MXWnlVreg4bIZuFzHm34j5f 5TixjWQ/9Vl+cUkSIGgsbkL/Tv8dT03Zs+0deH9ywI44sQUoMkQjuEhYrXBwTL1iGdmQ EBT3tY7DJcPjVKHcJtmJv5fFTw90YFMgOWyzZp+KMnBZZNWiC//oibThWgBfMzxQlnla s2YJBJxP5b1Oz2kHvjVDmoy3aGd1pMAkWQJikJTgom6ZW1JwR7w1yFCUI5IdAUiDJ114 yNuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=QXK1RqD77Q3kkr2OGKPxoeRjSMqRA2OKjLp6KlG0ZsY=; b=ToYkHriLT0WzZFpIu9TNFGTDjxic03T8dX7Q18f0h7bZXKLcXwz9vcjZqOAxRRx3Bu BKqsTNrGrPrv47ESaYgXlMS0pC9E0G9NFnLdo4dulf9+uZXBoOcNmL2hKVGC56GOOjWN Q6QEdoXstrmreqvLz7b4lQn2OnPJ5g6dFytNUje4psWALvzIdg2Z3ghStnAI4n7Fv7zS I9yCdfpasF89mUFdVuGrk4vqv+50dtqa7q9KSjhVALT84eUObKdsjWrz1R7KT5PRqBWb udSNFSJDRSh1/fk//T/qLLmnJiBlLSxVgDvijQhwoe8M407VqqbLyAKDOjFgznwZkgCX wP6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AI2KKYoJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id an10si7468543ejc.628.2021.02.22.17.52.58; Mon, 22 Feb 2021 17:53:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AI2KKYoJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230268AbhBVXpm (ORCPT + 99 others); Mon, 22 Feb 2021 18:45:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:54410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231419AbhBVXpk (ORCPT ); Mon, 22 Feb 2021 18:45:40 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 367AB64DA5; Mon, 22 Feb 2021 23:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614037499; bh=XFGxZWOiGtpFOFbxDLAcp9qcmWnZcBnW8fvwf4JwOUI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AI2KKYoJMwsJst0ReZUzZzHJvM48mdR1eVEerDmFbIOQCx+Vo6tjOLhfZm7NvM5LQ wsjSN9gL29VPZ/SF5w5Sf80Ju31iF4opqVp82iRk0yE5lcdra2LeHGoQR0z7EkyKmo OxuDkq5+M1KIpouzLub8Aw2cCOloNG4onrTbhJ+0x5HnZOSxmovGpitjAVMLc3MmIq d9fcw0QkR5uom7qqUP1rEvV8JSYOXt6jBGGPDt39/oMRihD7c1XN2ocACIKm6Gbyyu g66hqnC778VmU6V24/M20sicvRno8QM3kXwtH0gkxC/Erwe0nie4mQ77JAd52k0nl3 eSL/UHHUoL3cw== Date: Mon, 22 Feb 2021 16:44:57 -0700 From: Nathan Chancellor To: Simon Ser Cc: Souptick Joarder , harry.wentland@amd.com, sunpeng.li@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, airlied@linux.ie, daniel@ffwll.ch, nicholas.kazlauskas@amd.com, Rodrigo.Siqueira@amd.com, aurabindo.pillai@amd.com, stylon.wang@amd.com, bas@basnieuwenhuizen.nl, Bhawanpreet.Lakha@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/amdgpu/display: initialize the variable 'i' Message-ID: <20210222234457.GA36153@24bbad8f3778> References: <1614021931-4386-1-git-send-email-jrdr.linux@gmail.com> <32vjVDssCxltB75h5jHin2U3-cvNjmd_HFnRLiKohhbXkTfZea3hw2Knd80SgcHoyIFldMNwqh49t28hMBvta0HeWed1L0q_efLJ8QCgNw8=@emersion.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <32vjVDssCxltB75h5jHin2U3-cvNjmd_HFnRLiKohhbXkTfZea3hw2Knd80SgcHoyIFldMNwqh49t28hMBvta0HeWed1L0q_efLJ8QCgNw8=@emersion.fr> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 22, 2021 at 11:05:17PM +0000, Simon Ser wrote: > On Monday, February 22nd, 2021 at 8:25 PM, Souptick Joarder wrote: > > > >> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9804:38: > > >> warning: variable 'i' is uninitialized when used here > > >> [-Wuninitialized] > > timing = &edid->detailed_timings[i]; > > ^ > > drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9714:7: > > note: initialize the variable 'i' to silence this warning > > int i; > > ^ > > = 0 > > 1 warning generated. > > > > Initialize the variable 'i'. > > Hm, I see this variable already initialized in the loop: > > for (i = 0; i < 4; i++) { > > This is the branch agd5f/drm-next. That is in the if (amdgpu_dm_connector->dc_sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT || amdgpu_dm_connector->dc_sink->sink_signal == SIGNAL_TYPE_EDP) { branch not the } else if (edid && amdgpu_dm_connector->dc_sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A) { branch, where i is indeed used uninitialized like clang complains about. I am not at all familiar with the code so I cannot say if this fix is the proper one but it is definitely a legitimate issue. Cheers, Nathan > > Reported-by: kernel test robot > > Signed-off-by: Souptick Joarder > > --- > > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > 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 a22a53d..e96d3d9 100644 > > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > @@ -9717,7 +9717,7 @@ static bool parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector, > > void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, > > struct edid *edid) > > { > > - int i; > > + int i = 0; > > struct detailed_timing *timing; > > struct detailed_non_pixel *data; > > struct detailed_data_monitor_range *range; > > -- > > 1.9.1