Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A08972F23 for ; Wed, 9 Feb 2022 17:04:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B66F2C340E7; Wed, 9 Feb 2022 17:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644426281; bh=GIkXNhz8oaOhqayCMzeE+28iutBSWhbxVronQYj/VYs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tCWo92E4pLzlhQ6+xw81c43ydmZ9VGDk3KYy0l4f2x1rEnxiTOQzHtHSL+gD+hvLI BKB3Qzk9TbUSCIqXbCCYTAJFyc08OjHniWuHlobEremDJC+/3FwW8T5XkQZMkAOe2/ V8WUILhcW5eiiA6CdwH+0PU3Wc/ZeIda9OuWbhGPba4AvOEaHInI5pdoQcoUoS998B 0Rph2FYKB8xILFyT5bQj/mZjh2GQusPzZGUwzSi/zsCAi9DTnEMdTEuvgoCmqknQUG GEvvO0zYlqV6OpihOcQg1nJ60m0M6tjoUELV2TPXqmjQbbvhYOoe/5CnhD1z5kl7eb Mo+tITmGebotw== Date: Wed, 9 Feb 2022 17:04:36 +0000 From: Mark Brown To: Tom Rix Cc: lhjeff911@gmail.com, nathan@kernel.org, ndesaulniers@google.com, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] spi: initialize ret variable Message-ID: References: <20220209163029.2299009-1-trix@redhat.com> <61a545d5-224d-86fb-2fe3-406c3ffd78fb@redhat.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LDdwV0VGGqx5cXxo" Content-Disposition: inline In-Reply-To: <61a545d5-224d-86fb-2fe3-406c3ffd78fb@redhat.com> X-Cookie: Disc space -- the final frontier! --LDdwV0VGGqx5cXxo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Feb 09, 2022 at 08:44:21AM -0800, Tom Rix wrote: > On 2/9/22 8:33 AM, Mark Brown wrote: > > On Wed, Feb 09, 2022 at 08:30:29AM -0800, trix@redhat.com wrote: > > > Clang build fails with > > > spi-sunplus-sp7021.c:405:2: error: variable 'ret' is used > > > uninitialized whenever switch default is taken > > > default: > > > ^~~~~~~ > > > Restore initializing ret. > > Are you sure this is a good fix and that the compiler hasn't instead > > identifed that we should be returning an error in the default case? > If setting mode to idle is not really a valid state, then default should > return an error. Yes, that's what I'm asking. > The old behavior returned 0 and I am treating this as a regression. The goal here isn't just to shut up warnings, it's to fix any problems that they identify. Unconditionally initialising return values is a common way of fixing warnings while leaving real problems in place. --LDdwV0VGGqx5cXxo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmID9CMACgkQJNaLcl1U h9D1pAf/SvFPCFoqJZgZ/loB28nIiwS4C9v290MFima/UTb7p3sdg9OudfxI543q Ht6y3f4vnCe3+BPqM4JSfeetuuDBcbHihhhMUUe8gucz9vsMV70O5uTcQneTHA8a KcNRt2ZpE/TUwZSr8SvyzQ/I8FKpyDSoW796eknGdXue1YpKDKO03RrbKXRcy983 H1DhiG7lppE3D2eh1R0xRsf5tVIzryeruIbbQzZSxi/fGvo6XxUcJ2CRrN7ib2cl 6uoFbFkHxJo3o385Exv6TwDyFmhrLYjGYDCxV0iUfYTwlEZpBupv7+sHqd+KBbLo LkQ/wHpMaWHZfmN5sQ4wieDHJHBplQ== =+R4u -----END PGP SIGNATURE----- --LDdwV0VGGqx5cXxo--