[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdn=qYoBnsXrGh8KDaFzy6WEsfp1RhoZZQUHHL4OFzx88A@mail.gmail.com>
Date: Thu, 19 Sep 2019 09:21:14 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Jens Axboe <axboe@...nel.dk>, Christoph Hellwig <hch@....de>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Max Gurtovoy <maxg@...lanox.com>,
Chaitanya Kulkarni <chaitanya.kulkarni@....com>,
linux-block@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
Nathan Chancellor <natechancellor@...il.com>, kbuild-all@...org
Subject: Re: [PATCH] block: t10-pi: fix -Wswitch warning
On Thu, Sep 19, 2019 at 6:57 AM Arnd Bergmann <arnd@...db.de> 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@...db.de>
Reported-by: kbuild test robot <lkp@...el.com>
https://groups.google.com/forum/#!topic/clang-built-linux/awgY7hmSCCM
Hard to say what's the right thing to do here, there's not a lot of
other switches on this variable. That enum value barely even shows up
in the kernel. Since this is no functional change:
Acked-by: Nick Desaulniers <ndesaulniers@...gle.com>
Thanks for sending the patch.
> ---
> 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)
> --
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists