Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4673001rwb; Tue, 8 Aug 2023 11:54:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwRpYbh5M4HfBV8j0657I8brcUdp5N60vUwGYzjC1uWaWeURj1RxHFHnU/LkwIN3LivHhp X-Received: by 2002:a17:906:318c:b0:993:f15f:efbe with SMTP id 12-20020a170906318c00b00993f15fefbemr372693ejy.5.1691520866742; Tue, 08 Aug 2023 11:54:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691520866; cv=none; d=google.com; s=arc-20160816; b=uOvYYZwfJbqbaKZdWPVm2jgfcFacLbIwwvOQgoNHSo1E+s/3Ro4qY7pt9t1Q3+Lva/ IzlD9Dd3OwxfuzOVtuPggfCFIRpeoVNz8HOcrjOFO3RbBZSST7cHUVtERvfRc0YTXSfQ r0UAkdXQOWipto/j3BjI01Jg/7CJFZvAhnUZvXtGZWNzuBbDqO0ShyxeUV4tOlpfSY+Z w9vBQ8aKZBE/c+uqZr/JAX0Mqh+243ktA/K26ETPi4Xe+kQme8LIi3vcbPD81zvyT+Li TEn16qXYVkBR7Zk8aDz6F5Ifg1yqRdFAR35imIqC9NvE5wvjyUXbxXN1KKC0G/aDeJyJ abjA== 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:dkim-signature; bh=OUBXwhB5KWE99J+7DxT+qb83wSBio5WdJ1NWJLbedm4=; fh=Ds5RdvgCjXGOhxMK2vQcrmWaGcADZ0GyQx4MEGMFhws=; b=e8BD7zzPOgXGXnNZN2//aNka/nmQ40qDXd7Ye+C1Esuk7/wIxBGFLIf4rHcL11ltvk 1K4HlgvC1xYG++gNE3zQ+7Udr8FRcKRrsesZ7wrLon+X3rLH0yhIEPU5FJxUTkO+9163 uoKC7CKKQkyceS122G7XlI3shwRIAu2uojllDAn+5tZZsB2Z+z0ZBROSS8kP18J9nCiQ sL5YXBGoA5Zf5XGNb6C+AC8Jw+BBjUriOOPgl8Owaj/SDc/ffbBHzhmmVV+4LEKFOGKy 1a2RkhoFXsBe3VQQIIan2yj0ryh3GXXQrFwY/Wa+EM96F4L7NR79FXzKyf/MEy1/S8AV hT/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vFTrgJmV; 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 n15-20020a1709062bcf00b00993398bcae2si8155043ejg.122.2023.08.08.11.54.02; Tue, 08 Aug 2023 11:54:26 -0700 (PDT) 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=vFTrgJmV; 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 S234989AbjHHRq6 (ORCPT + 99 others); Tue, 8 Aug 2023 13:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232956AbjHHRpq (ORCPT ); Tue, 8 Aug 2023 13:45:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57DFC900A for ; Tue, 8 Aug 2023 09:20:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 61FDF625A0 for ; Tue, 8 Aug 2023 15:00:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44886C433C8; Tue, 8 Aug 2023 15:00:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691506836; bh=2cQOXwqn6SYODcUa7f0Mx6nUDgwXXurTh8Kk9vcpbVo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vFTrgJmVK0/2AZWeuZUJkTozX53OlymZF55AVH/LIu5aKeHKmX36OPL2av3VLkW8B pudVgn9cxiLPqCVpUyXUdT1EFdruGwhgkXsVfQfofUA86B7KcyHMe94ZLoTXF8l2Dm /oC3VGLCWM22fWr//7jzvJj+cSudjm6oduM6AS4UYu+h75LFmb52Qd26FgFyxfxjzh ObodANp8hg1jAfKUAlL1BpE6YcYLoLYIBXHvgoGnrpJcREw9/QAn/Si5bJprY+FLii hv5DOSG5vgqyJDpIg5AIe+Hlw8FzkbLj0WvwJ04PSgW/len+LRLqAWgqW3xQthFoxh O7aX4eb1tfYIQ== Date: Tue, 8 Aug 2023 08:00:34 -0700 From: Nathan Chancellor To: Arnd Bergmann Cc: Mark Brown , Weidong Wang , Arnd Bergmann , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ASoC: codecs: aw88261: avoid uninitialized variable warning Message-ID: <20230808150034.GA637683@dev-arch.thelio-3990X> References: <20230808125703.1611325-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230808125703.1611325-1-arnd@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 Tue, Aug 08, 2023 at 02:56:54PM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann > > aw88261_reg_update() returns an unintialized error code in the > success path: > > sound/soc/codecs/aw88261.c:651:7: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] > if (aw_dev->prof_cur != aw_dev->prof_index) { > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > sound/soc/codecs/aw88261.c:660:9: note: uninitialized use occurs here > return ret; > ^~~ > sound/soc/codecs/aw88261.c:651:3: note: remove the 'if' if its condition is always true > if (aw_dev->prof_cur != aw_dev->prof_index) { > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Return zero instead here. > > Fixes: 028a2ae256916 ("ASoC: codecs: Add aw88261 amplifier driver") > Signed-off-by: Arnd Bergmann Alternatively, it seems like the final 'return ret' can just be replaced with 'return 0', as every other assignment of ret returns directly if it is not zero. Regardless: Reviewed-by: Nathan Chancellor > --- > sound/soc/codecs/aw88261.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/sound/soc/codecs/aw88261.c b/sound/soc/codecs/aw88261.c > index 82923b454dd47..6e2266b713862 100644 > --- a/sound/soc/codecs/aw88261.c > +++ b/sound/soc/codecs/aw88261.c > @@ -652,6 +652,8 @@ static int aw88261_reg_update(struct aw88261 *aw88261, bool force) > ret = aw88261_dev_fw_update(aw88261); > if (ret) > return ret; > + } else { > + ret = 0; > } > } > > -- > 2.39.2 >