Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp824197rdg; Fri, 13 Oct 2023 02:07:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0rSUbHXVDnAnaaFzaUCM2BXVNE4VQ5yNHXcTG3wHAadbhrwqCZ0f7zxtaLuzoKJTi/iOi X-Received: by 2002:a17:902:e54a:b0:1c6:2d13:5b74 with SMTP id n10-20020a170902e54a00b001c62d135b74mr27863401plf.55.1697188057198; Fri, 13 Oct 2023 02:07:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697188057; cv=pass; d=google.com; s=arc-20160816; b=t1LJvRVcbIuZC8AxXaIIEzWS/zpPxk5SgepPkfFXYMc8acSh1EYo1cvQT0sC4TQTHX ms8ywORGrd+pf0cwztec5tYh+G4FPTdAmSgydpkJZGxAvERHb0ZfTomFExhH4YwWMMlZ Fx1AAR36OSElwqDRHNjProjbYw6gx4UdzRu7R2UoRggDj5eZqaVp/KZKDTxL7QXTgIb7 pMwnTPhxLihOkkZq7Tklw2s5IUTIiM5pWUfG44IJc+BpafG3XnWkrTLhKjnhjROcSBSB iAGzJgq98bIAk/lEN9g/JL3xPnH+4PVqD723brsUdkJBqwaKLd6duCN45nK5jaYGW06h CPOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=5JwLptKqrCtzzvTAz1R7QFeackvygPt5WFo6JI6yFNw=; fh=tlpr4fsnmszu42I7l69bNMWKmEHVoCbeRdv8eEXfXjA=; b=ONl4zkyd99a/6cPEtaa4gwpPGXLG9O7mmRu/4YwWDTvlvTYMfnVdKu6PRgZcUiqC3s V4BJWHEe7eGD7g+eH7ePCZoHy12Ni/VyQqKCc4dYecP0TVntbJFj7NMwq3cij+FrRbm0 4iOctXFRCsIifqwF+/TRO6OENPedxe1CmRr0wSc451WWOppdNR86T7PeJ3gXISvbbXIP iaFQU5NOOmrwL/TMnHnpRluURJfE/hPu2JALTQetlf8hy6x1XMq/hCXS74lxQQPp/yY9 3SMsB9tr+sZw6K+ST0UIfMmCitVbxK/om8lL/fIudXombx2ucBEBF4M80fxmcz0TCVmR pGQg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=3ZuRA9WH; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z6-20020a1709027e8600b001c72c792794si4110692pla.47.2023.10.13.02.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 02:07:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=3ZuRA9WH; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 050D682F27F6; Fri, 13 Oct 2023 02:07:14 -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 S230335AbjJMJHH (ORCPT + 99 others); Fri, 13 Oct 2023 05:07:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230296AbjJMJHF (ORCPT ); Fri, 13 Oct 2023 05:07:05 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2054.outbound.protection.outlook.com [40.107.244.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB3F1B8; Fri, 13 Oct 2023 02:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iBsKdMz60csfhz8zI6xS9f/QYzy73ylaMWn//gu29dPZK/hM+AT8bK0uVQVqzPgrI0VO6/vu9PB8cy44r+tYd49HvmMl/IO1ENpFlfzV6k9NxYAxoRsgkDO29UGAGchTVTf9Qn1UE/jac3o7UJ7FSXKYEmWiaLrCx1mDCRvIsVzo8WurwmuGOl/HOjR8iF96JOWvATwYRMWAl3zwhYcHlZLs2H7axiQyhBd7CtqHA+Rxaagu+pVmAAzL4yXHylL7BtPE93eveOlpQ7N5itRzuOkvWQkVOTFm4JqN+f6IS8ISteFQGMtCpeQk2nentCKcBM2/I3SDwu6VpWLP2kqGfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5JwLptKqrCtzzvTAz1R7QFeackvygPt5WFo6JI6yFNw=; b=i0NgLh7j7VHXJSTHxPmqairY4z3RUxOOvYbxSTf5T9pjiQckkTkxuKSVX+kLoqCW0jP5FvK3nbiIj0U0jWwrBrl+LVN9533c000xEuP9mfaTUDwGfGLkFVmmWcxT4wexD1o1iB72kjAjzlbV3rgSti1Nf9JpR5TT5yQvMx4AJ5xGgesrFzuVwshPthFnDtCcoQWl8jUw31Fzc+H0zj/Y3TTX7AMs1ygPuMDXly89Ku8OG1KS7QgybVN4kRz0SxdovXhm4M0+8VQNxHVaXJPCuWkbU5k/Kl3eXbUJtO5uYhx6B4yZhrJZi7DDJP4574jZILYXexSXRLVw3nCO2Q9J6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5JwLptKqrCtzzvTAz1R7QFeackvygPt5WFo6JI6yFNw=; b=3ZuRA9WHnf78PTCWZMKdxYN7NtMgIgj8oAMsKFXbSoYJaCvYYTjQRVByIXF+ak2vLJ2zDxfYc6RXAXTQN7o20JTB2q4h/rYWSrs64EJTaKBEMtdU4e5hQvKpv+MWnRcTM4RFsrJJfm1ve3dp7sYP597mmXXb1umisHZFu2q0c5g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from PH7PR12MB5712.namprd12.prod.outlook.com (2603:10b6:510:1e3::13) by DM6PR12MB4500.namprd12.prod.outlook.com (2603:10b6:5:28f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.46; Fri, 13 Oct 2023 09:07:00 +0000 Received: from PH7PR12MB5712.namprd12.prod.outlook.com ([fe80::ec22:9c20:11d9:e840]) by PH7PR12MB5712.namprd12.prod.outlook.com ([fe80::ec22:9c20:11d9:e840%6]) with mapi id 15.20.6863.046; Fri, 13 Oct 2023 09:07:00 +0000 Message-ID: <6955339f-9bc5-4a84-acdc-205b90d4127c@amd.com> Date: Fri, 13 Oct 2023 14:37:04 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] perf/x86/amd/uncore: fix error codes in amd_uncore_init() Content-Language: en-US To: Ingo Molnar 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 References: From: Sandipan Das In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN3PR01CA0039.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:98::15) To PH7PR12MB5712.namprd12.prod.outlook.com (2603:10b6:510:1e3::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR12MB5712:EE_|DM6PR12MB4500:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d6b3a05-0f50-4928-dfd8-08dbcbcbc205 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JXSrn3K3HC9lGWOSrJmFDghQtvlLAcN5Dzxy6/ymynPpD4bTfqlFK2R327aC3HQrsHfqz6OBThd+r/v7qB6od2FAhyP4+4VOOaR4phf42J9KklAXb3JoXdAb0iVUyeYxWd72yeIk7jN1xMVDz1lvbBXByyqXULDFrrEYfDgUeAHH3vseY3viQHUCPmCqQMHf8hX8NlKSNGoNCJMpnoL4TnGM80PJQO/94nkFQqe19yxGT6FCHCqFc5h5d9hyLVl5H9npbb66J1xIv1f6KaEosXHYcG10dMKB7UN00kJLaMU6FAI4U6ShbTuBIRwhpXxIrmSCwCUZNZAAgMapZ/CjGb6mqXeww7MhOYDERaEohDRNNw5qzpehQmrDlfzgEyVciaVS8PWGev+pD2r3AyNos3l/3B9x2i4ZEdAvFddjuWsBghvIIcNZk2KkQzeydRcIrCBMPrjYYep3ZVWXXZfsTXwalK16Rb/utLHYGeEWDQg2tUXcmUb04BLnodSqNaLcjaP65Kpqgw+tRlgfHGtQWnfI2C/BJex/5bW19d078MFQyF5Y3CtAcUrLQEEX0LY+e1K2SIxDTRxiJO4fvbOM1EwGa/U3WOspcSPDNg+4Yi7XyqN5i7DFO9jpbN8MEgBznqaVBD1OQLIDl63pWp1Ncg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB5712.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(396003)(346002)(136003)(376002)(39860400002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(6512007)(6506007)(83380400001)(26005)(38100700002)(53546011)(2616005)(6486002)(478600001)(31686004)(6916009)(5660300002)(66946007)(66556008)(66476007)(54906003)(41300700001)(8936002)(8676002)(44832011)(4326008)(2906002)(7416002)(316002)(36756003)(86362001)(31696002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?blBTaWVoT01acGpNOVN5R056Mzg4VW5LUkYyK0dyb2pvZUcxaTcxMUptajlj?= =?utf-8?B?MVZ2TmxUKzdnbE5XZDN2L3FiZlJHNUxPU3lOcmVEWWVENUpKWmdUNE9PcHUw?= =?utf-8?B?S1hWLzMrKzVENjI0dFk0T1JHNGlUVTU2dDZqQmVVZDR4N2VOQzdhMERFczFZ?= =?utf-8?B?dTY0cXBFeXpEaHB4b3ZXREs5RlhtZmxoazREQnJ2YlU4bkJWZUEySnA1dU9q?= =?utf-8?B?eEJaS0p0bG13UFRjbUplWEVZbnV0SnVVWThLRFZma2htOVExQXdOaU1QZ1Rm?= =?utf-8?B?TmxLRWh5QUxVMDNpblRsVE5NcURhTnBON0VRZGs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?IFFzY3TB2T1XbMveYTuGarTCC?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d6b3a05-0f50-4928-dfd8-08dbcbcbc205 X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB5712.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 09:07:00.0357 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lJAh8oQ1ANpP88HS29TUJ/9EwlI3yD0uRqVLBcuFGmco6Qk6NzSKc0vz6J9L9m25TIt7JjWNHGwrHk5fLYxOjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4500 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE 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:07:14 -0700 (PDT) On 10/13/2023 2:33 PM, Ingo Molnar wrote: > > * 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? > Sure. Will do.