linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <natechancellor@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Max Gurtovoy <maxg@mellanox.com>,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	clang-built-linux@googlegroups.com
Subject: Re: [PATCH] block: t10-pi: fix -Wswitch warning
Date: Thu, 19 Sep 2019 23:05:03 -0700	[thread overview]
Message-ID: <20190920060503.GA130425@archlinux-threadripper> (raw)
In-Reply-To: <20190919135725.1287963-1-arnd@arndb.de>

On Thu, Sep 19, 2019 at 03:57:19PM +0200, Arnd Bergmann wrote:
> Changing the switch() statement to symbolic constants made
> the compiler (at least clang-9, did not check gcc) notice that
> there is one enum value that is not handled here:
> 
> block/t10-pi.c:62:11: error: enumeration value 'T10_PI_TYPE0_PROTECTION' not handled in switch [-Werror,-Wswitch]
> 
> Add another case for the missing value and do nothing there
> based on the assumption that the code was working correctly
> already.
> 
> Fixes: 9b2061b1a262 ("block: use symbolic constants for t10_pi type")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  block/t10-pi.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/block/t10-pi.c b/block/t10-pi.c
> index 0c0120a672f9..055fac923946 100644
> --- a/block/t10-pi.c
> +++ b/block/t10-pi.c
> @@ -60,6 +60,8 @@ static blk_status_t t10_pi_verify(struct blk_integrity_iter *iter,
>  		__be16 csum;
>  
>  		switch (type) {
> +		case T10_PI_TYPE0_PROTECTION:
> +			break;
>  		case T10_PI_TYPE1_PROTECTION:
>  		case T10_PI_TYPE2_PROTECTION:
>  			if (pi->app_tag == T10_PI_APP_ESCAPE)
> -- 
> 2.20.0

I didn't have the break in my local patch but I think this is more
correct based on the description of the enums. Like Nick pointed out,
there is no functional change because this value is not used in this
file.

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

  parent reply	other threads:[~2019-09-20  6:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 13:57 [PATCH] block: t10-pi: fix -Wswitch warning Arnd Bergmann
2019-09-19 16:21 ` Nick Desaulniers
2019-09-20  6:05 ` Nathan Chancellor [this message]
2019-09-21 22:05   ` Max Gurtovoy

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=20190920060503.GA130425@archlinux-threadripper \
    --to=natechancellor@gmail.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=maxg@mellanox.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).