Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp822418rdg; Fri, 13 Oct 2023 02:03:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1R6YYuvvvXqSQI3be45bG6lwUYzvaU6UtnnO/dqkDWb+sHA3EK4cY2LQVI4lqqHNpnYiB X-Received: by 2002:a17:90a:f317:b0:27c:f8f4:fedb with SMTP id ca23-20020a17090af31700b0027cf8f4fedbmr8752053pjb.21.1697187829833; Fri, 13 Oct 2023 02:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187829; cv=none; d=google.com; s=arc-20160816; b=R2zH0WSm5owRfbrMY93Xt0eYuC0LMUOKt5QLOAmtFVOvsCS0e4vx4K/9NKb9sYaQBx 6Cc0XrVqiQV1jB3Dx4S21JuQQrqo/2UZdJh3yshLCrzTj0FlGEG/S2PlScQAmyvlICx3 vJNLhB8QyFf9+EhBMvGZfo7be982+9+Xomqxx5dRV/uPuHsqv0DiHz8ImtOyvFwZH1MQ UB9/iXwJ1GwwF9t1KM16xCQ7/NElOPT6eQOFUygY0Er4X5HmW2ADYWlKRwiBDh9kGc/Y Y+STh+Sja8mPmxcl1h8wWSlTOvO+O0SuIVPy/tuVb3+vKNskGVas5BLL8NMYYcB2dmEN F0gg== 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=mVXzaNCQ+HvBISgUOUJ4L9y3uEa9RCaldYHVY2YAQiM=; fh=5GwocL0v0jyyq0TqdiQR8uLTV5q02jruCHUtFFAqZoo=; b=FXwSYdWhs6gsKNeUja1YiO/R+s28a/3ekzbaw5qrqBVv69w1F6oMVNugFS9py+LXQs UKpHqJNtNqILzaD4WZeUI6ERKCRzvR+QUR8/7pKA63QMYQxL4sTVPG0bam9VbBN00aJX DTaZ5nRBAk/YkbbvuFYCDNmMEfLNEwKdtt4XsWMA9Zt3Jo4ezCdmbkfpfBzFto7Fydv1 Mb99z3OpqmlFXIchpNhZR3OiKDuT9xU38/zjeiRMYkuKHJIzSY6500OYXZgRNT5dOjnp v/2fleXT/hDyuZTnFhqWRRPjcxyuc06mTpGzVFvF5RKF/k/MYdYIh4e0QG7sx3oSLsVC RjrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="k20zYg/b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n23-20020a17090ac69700b0027d032092d7si3933220pjt.184.2023.10.13.02.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 02:03:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="k20zYg/b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 083928061B43; Fri, 13 Oct 2023 02:03:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbjJMJDr (ORCPT + 99 others); Fri, 13 Oct 2023 05:03:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230160AbjJMJDq (ORCPT ); Fri, 13 Oct 2023 05:03:46 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82AF895; Fri, 13 Oct 2023 02:03:44 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-32d849cc152so1781575f8f.1; Fri, 13 Oct 2023 02:03:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697187823; x=1697792623; 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=mVXzaNCQ+HvBISgUOUJ4L9y3uEa9RCaldYHVY2YAQiM=; b=k20zYg/bYmrGUQvX3T6N+NxkeIHyufUrLU5ZOQVuAabVIfSdj7TrxFmZHV+6WtrP3/ Zy1xv6NBHQPClOOAojsgsR7hWTKviJIySdikbDsIo/cURoj9JHDuQ8CBGycei2BM03eq CiK4aLPw9OalKAYeTXbsnazt6K6bIYwCKayuI4HcGwxO8yKC9sc+A1J2qlqnDJgWFQH0 hyccD4l4GBLVTt1RMt/IokssGQDBpCmd/1AoWNL1cM9g1i2XHdb7l/3xc89Msn2lSOhG 3I/dU53e8OxIP26/vfHgWczsnDWP9x/hGtwa2+o67eCAlaDlRDzYU9bBnSaAQRYNxYjA Yc9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697187823; x=1697792623; 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=mVXzaNCQ+HvBISgUOUJ4L9y3uEa9RCaldYHVY2YAQiM=; b=gXcA7pygHWZzakysZjvuEmhaQec5MqCOtdLC1TaqyitYKLCL5ewZg7E4o6oYCBcjeg k0wc+6j87VTOpeH6JGH3WPWCl55bEIL2kktPMjLANURcMWohSpCMNXGwZTTN6rsWstqs 96LUhHV8X+pc2gt3G2OE8qAio1kT0W4hCsqfC769z0jEAvw8oZtYJjxcCQozps0pDxle wCfqp/eAvRiX9ClFTher29aTHNg2gMF8+IbuE/g0VhSrYbbmPS6hr9wjjz42t6yEYe2Q IL3jCw0K8qFWL2Eqjls4VHSOds5g0quuLCjt2Q/cBo5qzV3XppjObNAvOj0hE//lSLNa rKgQ== X-Gm-Message-State: AOJu0YwAVz5TpUYa248SCTE3CtZ4JDhDdgllohohIA41EZNpWoCtl1aV hJHrDUiWoRdLLaFVvR+hZZ8= X-Received: by 2002:a5d:5a86:0:b0:32d:260b:5b7b with SMTP id bp6-20020a5d5a86000000b0032d260b5b7bmr9876635wrb.11.1697187822845; Fri, 13 Oct 2023 02:03:42 -0700 (PDT) Received: from gmail.com (1F2EF405.nat.pool.telekom.hu. [31.46.244.5]) by smtp.gmail.com with ESMTPSA id m8-20020adfa3c8000000b0032d7fde2d3csm8136690wrb.79.2023.10.13.02.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 02:03:42 -0700 (PDT) Sender: Ingo Molnar Date: Fri, 13 Oct 2023 11:03:39 +0200 From: Ingo Molnar To: Sandipan Das Cc: Dan Carpenter , 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 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 13 Oct 2023 02:03:49 -0700 (PDT) * Sandipan Das wrote: > On 10/13/2023 12:48 PM, 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) > > > Thanks for catching this. I see that 'ret' remains uninitialized for cases > where the hotplug callback registration fails and was thinking if the > following is a better fix for this as the reason might not be ENODEV. Yeah, passing through the real error codes is usually better. Here's it's probably a bit academic, as I don't think we are even using the init return code in the init sequence iterator, see how the return code by do_one_initcall() gets ignored by do_initcall_level() & do_pre_smp_initcalls() ... Nevertheless, mind submitting this as a separate patch? Thanks, Ingo