linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Tom Rix <trix@redhat.com>
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
Date: Wed, 9 Feb 2022 17:04:36 +0000	[thread overview]
Message-ID: <YgP0JOilWpKU4704@sirena.org.uk> (raw)
In-Reply-To: <61a545d5-224d-86fb-2fe3-406c3ffd78fb@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-02-09 17:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 16:30 [PATCH] spi: initialize ret variable trix
2022-02-09 16:33 ` Mark Brown
2022-02-09 16:44   ` Tom Rix
2022-02-09 17:04     ` Mark Brown [this message]
     [not found]       ` <CAGcXWkyCQ4JExvHv3cEL7vLMOcq_iPu0vOyOmnfzbQmMxHEp=Q@mail.gmail.com>
     [not found]         ` <27a1822d798641f5bba33d7529ec02c0@sphcmbx02.sunplus.com.tw>
2022-02-10  2:45           ` 郭力豪

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YgP0JOilWpKU4704@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=lhjeff911@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).