• Max Gurtovoy's avatar
    block: t10-pi: fix -Wswitch warning · be21683e
    Max Gurtovoy authored
    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 a BUG_ON statement if we ever get to t10_pi_verify function with
    TYPE0 and replace the switch() statement with if/else clause for the
    valid types.
    
    Fixes: 9b2061b1a262 ("block: use symbolic constants for t10_pi type")
    Cc: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarMax Gurtovoy <maxg@mellanox.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    be21683e
t10-pi.c 7.72 KB