Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1180698rwl; Thu, 5 Jan 2023 09:43:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXvvODnhZWY2snpsUXa7Bh3nw7rLixbVngljAdD8VROF6MHd7wEFtXj0qs2/bIEbD38Z4jeN X-Received: by 2002:a17:90a:460a:b0:223:ed96:e3ca with SMTP id w10-20020a17090a460a00b00223ed96e3camr55569302pjg.28.1672940639015; Thu, 05 Jan 2023 09:43:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672940639; cv=none; d=google.com; s=arc-20160816; b=IYQTehcOS9tTTzlLsqS/qDoDSVjzd/V1YJzSIOFtd3wFaE8T4tc1pJ+m4Z5q2wqBf+ lxSkQlwO0mSqqtr8K3PrN0/rCI2chguJPinGHb/GXYDNPepcr2NrtLpdYoa6zzLadJju pFuUXHZetHW/67TLagfjHvjmU2j8+TPEg0Uuf52a7bJBRMl3XC91ijQUkuH3WsbS0rWL my9A1N2i1YhYys4sOURpsZUJxYOl2EFivNIXJ9sxnTMFmEqPJYFyzGx7ZwcqBP7RK+we 3WE1KsqkLgxRACQs/dPFedfAIECkyEb0L8SLN1FKlD/cyRhgj95T7IvnvQJoMUOhGNWY CsKA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=i2ibsezfATm1WP316pRhjuiRAWRrx+WDUO2FGMgydTQ=; b=0BwfKFWwLC9xEWpEoIadkvNK0niXYCdlNZySCrvFBFK5NMLKPTj92Kn71kn5ZsJBnr FtasFRM9liZ1ykFWWNDmMcpawRTgJi2CC+YBhZ7oOWjaem+X45lzAtZSSl8r8JwLvdYu g/PHOE92qM+E1OSvCteI5DIht2/IPggwUZJ5k1z8tM18wOm6Q2a3/jqvB/H1piE4XqMl P5j8wsbjyBF8Gwkw/GKSzgjYJQFzyjyuOs6kRlXfG1LMOeDRHM4PPrEr7KlHmc6xGMCh EyWW4C/oUXbdJ/Fkh8pnYhOjh60AAhWhH7GXKYR+KvpK9uc9ecGm9Un/NtN7cQzZ5EDE GJig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c9POn9Ky; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x76-20020a63314f000000b004788e156154si41997375pgx.360.2023.01.05.09.43.51; Thu, 05 Jan 2023 09:43:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c9POn9Ky; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235110AbjAERen (ORCPT + 55 others); Thu, 5 Jan 2023 12:34:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235231AbjAEReZ (ORCPT ); Thu, 5 Jan 2023 12:34:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C423C75 for ; Thu, 5 Jan 2023 09:34:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8205A61BA7 for ; Thu, 5 Jan 2023 17:34:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C901C433EF; Thu, 5 Jan 2023 17:34:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672940063; bh=1fJkf23oCC2RJXN3Sa96FKGl2kzGrLdl82SeNdIED3E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c9POn9KyAvZpA8TrcSCtD9gQCcT8BJmznj4R/0Dq8zNzyRJC9/oPeGCUIhNK1InCE 4VadieJ0ZyQMxdXDv52cJDDaOPyrASMFMt6tPOCIAk1i5qN2udI0Twn1ZZQ1c145V3 /qGYeNM0qmvRgx/KZgeh24ZYoBhgsf3q0flkSdMhKA//aSByerLUTFjMt17Am1X/wl sZT5gkh6EpgPr6xM/9HGpmtsLvTh0K4qO4mYcAZ0Tr4MwH/fMKvovK8mrbhJo/EkZY hYR+RCzdFcPc0pFgXpYxyngvdFf2epPAEZ5I8AUzYOh6UglVUu5FM1ZHyRFsJ+M0BR 5bMnYXqvTLjEA== Date: Thu, 5 Jan 2023 10:34:21 -0700 From: Nathan Chancellor To: "Mukunda,Vijendar" Cc: lgirdwood@gmail.com, broonie@kernel.org, Syed.SabaKareem@amd.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs() Message-ID: References: <20230105-wsometimes-uninitialized-pci-ps-c-v1-1-4022fd077959@kernel.org> <6bb126b7-1cb4-0c4c-d357-fadc3ffdd3f9@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On Thu, Jan 05, 2023 at 10:11:09AM -0700, Nathan Chancellor wrote: > On Thu, Jan 05, 2023 at 10:34:10PM +0530, Mukunda,Vijendar wrote: > > On 05/01/23 21:23, Nathan Chancellor wrote: > > > Clang warns: > > > > > > sound/soc/amd/ps/pci-ps.c:218:2: error: variable 'ret' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] > > > default: > > > ^~~~~~~ > > > sound/soc/amd/ps/pci-ps.c:239:9: note: uninitialized use occurs here > > > return ret; > > > ^~~ > > > sound/soc/amd/ps/pci-ps.c:190:9: note: initialize the variable 'ret' to silence this warning > > > int ret; > > > ^ > > > = 0 > > > 1 error generated. > > > > > > Return -ENODEV, which matches the debug message's description of this block. > > > > > > Fixes: 1d325cdaf7a2 ("ASoC: amd: ps: refactor platform device creation logic") > > > Link: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FClangBuiltLinux%2Flinux%2Fissues%2F1779&data=05%7C01%7CVijendar.Mukunda%40amd.com%7Cad26656c3d2f4c75d00208daef350528%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638085308267581104%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=eeHVStOIOcy%2FdDISOKlGNeyEwx4i5AtJZmQ5dcNB7XQ%3D&reserved=0 > > > Signed-off-by: Nathan Chancellor > > > --- > > > sound/soc/amd/ps/pci-ps.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c > > > index 401cfd0036be..f54b9fd9c3ce 100644 > > > --- a/sound/soc/amd/ps/pci-ps.c > > > +++ b/sound/soc/amd/ps/pci-ps.c > > > @@ -217,6 +217,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data > > > break; > > > default: > > > dev_dbg(&pci->dev, "No PDM devices found\n"); > > > + ret = -ENODEV; > > ACP PCI driver supports different configurations. As per design , even? when no child dev > > nodes are created , ACP driver probe should be successful. ACP PCI driver probe failure > > causes power state transition failures when no child device nodes are created. > > We should not return -ENODEV in this case. > > return 0 is enough in this case. No need to de-init the ACP. > > Thank you for the review and input and sorry for getting it wrong! I > will send a v2 replacing 'break;' with 'return 0;' shortly. Actually, I re-read your message and looked at the code now that I am back in front of my keyboard and I am a little confused by your message. Should 'goto de_init' be replaced with 'return 0' to avoid the call to acp63_deinit() or should ret just be initialized to 0 in this block so that the call to acp63_deinit() still happens? Thanks again for your input! Nathan > > > goto de_init; > > > } > > > > > > > > > --- > > > base-commit: 03178b4f7e2c59ead102e5ab5acb82ce1eaefe46 > > > change-id: 20230105-wsometimes-uninitialized-pci-ps-c-3b5725c6ed31 > > > > > > Best regards, > > >