Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp786635rdg; Fri, 13 Oct 2023 00:31:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRGs0e16g4++eUR2DWKzzK4iTuCsdPzgRZjHRQ0v85RQHwxkjsafK/zpAaheAFBdLDpRoH X-Received: by 2002:a05:6870:12d0:b0:1e9:af65:e30b with SMTP id 16-20020a05687012d000b001e9af65e30bmr4637801oam.38.1697182270932; Fri, 13 Oct 2023 00:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697182270; cv=none; d=google.com; s=arc-20160816; b=WBvl7RGvsEcNIbPVTyXBrRN87ypYs2kbjfDOBWZhZkuN5pDHsOLpyFmj09SGsEnESH 7k4GB0frvzsJmw+5T1fVwHE+FkqR5GKkIgktGlCdBJR7UyUQfPGQ9tr1ClkHcp5Y7ngv Si9q/cy4YYaIAi7OWlHOATG2Zt4YW2fcs/GD4MWqhgvPJz8CW3gmIFAQuOUgQIB6JIsN oW1XQlchURmJjWueEiwdHbkdAJhtZrHcUIrEIMZfrZT7jjiEKFDhVuWJUZLB2twcRtQ0 eDRfqskH9WUjbMjAmP4NIOE94FnyBcAHKKKpfS2V/sppBMmm2cFV+30FPm2ITpQV+RSN pPGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=vzVL5vVmRYO7lL+aDIjM1G9uTaxxQRQWQ2vKxVi0PEE=; fh=rcpSQJwAy9uYRsoqiMkGiY8z+NUkQOZhR69GJ/KTMKQ=; b=zHph6f5bjKmrlHa5RNq+l1SwhqtkKYJvJmeQRB8f383n6Q4Xd0TwnH+dCbhrMjMvhA FrAAQ3YxFQsxelWw4F36wTbhF0H8OhhciS5PMbnwqNRMFrph+sxzs365x9a1vWx11Fp8 QwzQgvPNBxWQsMZEKB0toezcH/OaJKlvDPV0s0bOh0abCUXMquSw20EA8cWjd22lRHKM QeXmbA0qZFH5ldAPsnNdOQvULDVCt0ZvrtZQ6U6x0kJErqvibdclrj33P9/otpGNmJ9K 5fqcnFZLpqWia0JyqHsv9P4bD62gH1ttubyAQIzNezvTPQhqk2MfuCETvrWTy+knpOCh XLww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aVDSiank; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id b7-20020a63cf47000000b00573fc6a17dbsi3861601pgj.435.2023.10.13.00.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 00:31:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aVDSiank; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id D75A180D5432; Fri, 13 Oct 2023 00:31:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbjJMHay (ORCPT + 99 others); Fri, 13 Oct 2023 03:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbjJMHax (ORCPT ); Fri, 13 Oct 2023 03:30:53 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0F27B8; Fri, 13 Oct 2023 00:30:51 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40537481094so19401545e9.0; Fri, 13 Oct 2023 00:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697182250; x=1697787050; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=vzVL5vVmRYO7lL+aDIjM1G9uTaxxQRQWQ2vKxVi0PEE=; b=aVDSiankkK8vXZeHSgWVWxEcPu7tkybVPvPmusHLHOfPoTKLWS+pUCSuROzuDaeHgL oZG5iXUrw+gTe9m8hHLTdalAP6mw7KDu1e+W+mJ47g1cKVC8VNAqT4CrqSf1yzG6Xb1Q +bsW5AdSNdxOrm2ySJHxb4Q5DOIbqbdwich18k3bI/d9LAaR8gBh/s8FYkR9AX93B3u8 hL0U0btNw2R3zpdqk5wMNCoyLt6MrbjPiq5y0dknbcYzFtepDLbJvY4AH+30iOuApnVo 6BDN/ocz7yOrnXyBSjlfSdIo+/fWZeL2/xDz85/AvaJ4opKDKjVDFjbW8ZElWoHnt55t D6Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697182250; x=1697787050; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vzVL5vVmRYO7lL+aDIjM1G9uTaxxQRQWQ2vKxVi0PEE=; b=jFnm6lS5b4f/28OmjPS1AxQEmmnYqqLp8xiXAW0j1MRYql4cW/b6ohVi9cWG6q2N9e NQAGNrV1Lix2ynn2GyOeCTQ0v2ko+Tt1d6manfLe2oy66S+RudyPkgu7zyIxlXMAWtx8 jKAmJ3ju0Si4HKGVySUmUEmoulw+IQJZc4+CPp3KtYFIYrsbqGAXjym+2qTY5UIm2vT/ FJz+8X77XqTLLcP2zEyuhQjtn74UOExMVtP+8bYwj+jR79ncHS+2ch7tVgbTQHllyD5n XVFu8Bn9866AxKANlvOebwzO1NyNvODMPiNlHW+zrAws1xH7QbyDpAF0JTAZp5Vnls0B yOVg== X-Gm-Message-State: AOJu0YzcgWCCZi2fyWHmZtXeuvzWYiI6Pk0Wjz+RUiIFVipxOmZc5Gab mjZzhDahXQJzsMva6m+yJ5k= X-Received: by 2002:adf:a31e:0:b0:32d:888a:c2cf with SMTP id c30-20020adfa31e000000b0032d888ac2cfmr6034412wrb.7.1697182249845; Fri, 13 Oct 2023 00:30:49 -0700 (PDT) Received: from gmail.com (1F2EF405.nat.pool.telekom.hu. [31.46.244.5]) by smtp.gmail.com with ESMTPSA id h15-20020a05600016cf00b0032cc35c2ef7sm9889328wrf.29.2023.10.13.00.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 00:30:48 -0700 (PDT) Sender: Ingo Molnar Date: Fri, 13 Oct 2023 09:30:46 +0200 From: Ingo Molnar To: Dan Carpenter Cc: Sandipan Das , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Thomas Gleixner , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Uros Bizjak Subject: Re: [PATCH] perf/x86/amd/uncore: fix error codes in amd_uncore_init() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 13 Oct 2023 00:31:06 -0700 (PDT) * Dan Carpenter wrote: > Some of the error paths in this function return don't initialize the > error code. Return -ENODEV. > > Fixes: d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore management") > Signed-off-by: Dan Carpenter > --- > arch/x86/events/amd/uncore.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c > index 9b444ce24108..a389828f378c 100644 > --- a/arch/x86/events/amd/uncore.c > +++ b/arch/x86/events/amd/uncore.c > @@ -1009,7 +1009,8 @@ static struct amd_uncore uncores[UNCORE_TYPE_MAX] = { > static int __init amd_uncore_init(void) > { > struct amd_uncore *uncore; > - int ret, i; > + int ret = -ENODEV; > + int i; > > if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && > boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) Ugh, why on Earth didn't GCC warn about this? The bad pattern is pretty simple & obvious once pointed out ... compilers should have no trouble realizing that 'ret' is returned uninitialized in some of these control paths. Yet not a peep from the compiler ... Thanks for the fix! Ingo