Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1968155pxb; Mon, 22 Feb 2021 16:18:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyy1sg2PRJpbOYM3u6Cvx6inlORZnDrWsiKzSWuzgXIUpePqapRmJED76QJM0+arrOUJrtQ X-Received: by 2002:a17:906:c82e:: with SMTP id dd14mr11916113ejb.102.1614039508481; Mon, 22 Feb 2021 16:18:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614039508; cv=none; d=google.com; s=arc-20160816; b=IbD/mFdeqZ8vNbrGp1kLiAQ9T/7+gpN7K8hAMTnrIFAnNGB2bRn6DtcqHi4k+5+7ud FhKa5geiJlk6PFfeBlc/00CWd/GV2r8l6jYnLNmWqZHZxxxTbk1jnvzGEQodmfBurfQc c2JqcJUDX6EQ1ZftYV7ZKHlOonOd6tNNMYMqkh/t4heg3ZdPaTzBkwOWCkxSzeIA+rB4 Or9nbmehRObAYYchx4qvzQzHbZHBOaMxnq5w4eygRFfl3D1C47o9w0BRqW3CRyXCs0xP LCunpGspVuNk58n8YAfaK47VwtPGFTUYM3cNZnM07lrF5Vxg79+jai2jWwF9Mpp9i7pQ cWZw== 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=RMn5AAU4sjjjcdzdD8gimVTDYt4uy40k2aawVKeId8M=; b=Y42XNcnDdarG/VqGDT3+rT2CVJHoAjBrHf9bmDPUnnOKqIPcLrYhjs0sKJJQv8+Wzp d4vSO/x6B0kLe+x6vUSj08+KpKHtTcI+kuf31lNkMr5tfMVicbkEudNbTqFV10vULIlY 3nN2cxyjnofN6X+b9aKnWdE2Sn44l0xNJM2tW2Y2DMe8Ix+kQxPx7lV6zWpPeqWyqCsv GRqRqaxWv6QVDQwJRl+8xoOTDJaYQ6C3tRNXk1uOtAG5F8AMm84VQi15SHOpGWF594gr SLXPEMZSAx88weEQycUWnjuF4zj2RKGaETwBOs1AqOIGDPkjhFJ9VsHKe6g1yL5AL13B oWaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="nV6TYhL/"; 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 hd17si632115ejc.133.2021.02.22.16.18.01; Mon, 22 Feb 2021 16:18:28 -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="nV6TYhL/"; 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 S230384AbhBWABg (ORCPT + 99 others); Mon, 22 Feb 2021 19:01:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:55994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231408AbhBWAB1 (ORCPT ); Mon, 22 Feb 2021 19:01:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 97E0360C41; Tue, 23 Feb 2021 00:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614038446; bh=af3kVTgsG+nH3bM3IYnJBqeSQYehgcaCIygkIvqVjeQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nV6TYhL/oZNC9ifaFgtV5DjQUEKW4ct/RZXzL5cEAO+OEiYaRVvJB6MnQTc1GgLDg ZxZPHOSv1bmmm50hjEKCBKAdJy06dDuQgJws05+gPJ7vhenuXz0IbFL9AHEcQCGmZu imEAdGj/OEhQSAKHAz3rHudTUwkOAJGTbcsmgQ3E4mnIeJk4ydl08iGkjwUVUAN1X+ gpuniD1QjbCS0WDVI9g2unaM1LUFoC9It+wtjRh0GXnNVsd+VoG5YBbI4/JwHcPTrq FRtTYoRRzhd2gk02YLalZuf1ZGsh62b0eufN0g4UGVYTpcrawf1WR9HZdvEwjFLc3p nD7cOeD11urKg== Date: Mon, 22 Feb 2021 17:00:45 -0700 From: Nathan Chancellor To: Simon Ser Cc: stylon.wang@amd.com, sunpeng.li@amd.com, Bhawanpreet.Lakha@amd.com, dri-devel@lists.freedesktop.org, Rodrigo.Siqueira@amd.com, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, nicholas.kazlauskas@amd.com, airlied@linux.ie, aurabindo.pillai@amd.com, Souptick Joarder , daniel@ffwll.ch, bas@basnieuwenhuizen.nl, alexander.deucher@amd.com, harry.wentland@amd.com, christian.koenig@amd.com Subject: Re: [PATCH] drm/amdgpu/display: initialize the variable 'i' Message-ID: <20210223000045.GA4304@24bbad8f3778> References: <1614021931-4386-1-git-send-email-jrdr.linux@gmail.com> <32vjVDssCxltB75h5jHin2U3-cvNjmd_HFnRLiKohhbXkTfZea3hw2Knd80SgcHoyIFldMNwqh49t28hMBvta0HeWed1L0q_efLJ8QCgNw8=@emersion.fr> <20210222234457.GA36153@24bbad8f3778> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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:50:06PM +0000, Simon Ser wrote: > On Tuesday, February 23rd, 2021 at 12:44 AM, Nathan Chancellor wrote: > > > 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. > > I think you have an outdated branch. In my checkout, i is not used in the first > branch, and is initialized in the second one. > > https://cgit.freedesktop.org/~agd5f/linux/tree/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c?h=drm-next#n9700 That branch is the outdated one: https://git.kernel.org/linus/a897913a819191550ab2fa2784d3c3ada3a096d3 Please see: https://gitlab.freedesktop.org/agd5f/linux/-/blob/amd-staging-drm-next/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c#L9854 It was introduced by commit f9b4f20c4777 ("drm/amd/display: Add Freesync HDMI support to DM"). Cheers, Nathan