• Arnd Bergmann's avatar
    drbd: address enum mismatch warnings · 4b28f3b4
    Arnd Bergmann authored
    gcc -Wextra warns about mixing drbd_state_rv with drbd_ret_code
    in a couple of places:
    
    drivers/block/drbd/drbd_nl.c: In function 'drbd_adm_set_role':
    drivers/block/drbd/drbd_nl.c:777:14: warning: comparison between 'enum drbd_state_rv' and 'enum drbd_ret_code' [-Wenum-compare]
      777 |  if (retcode != NO_ERROR)
          |              ^~
    drivers/block/drbd/drbd_nl.c:784:12: warning: implicit conversion from 'enum drbd_ret_code' to 'enum drbd_state_rv' [-Wenum-conversion]
      784 |    retcode = ERR_MANDATORY_TAG;
          |            ^
    drivers/block/drbd/drbd_nl.c: In function 'drbd_adm_attach':
    drivers/block/drbd/drbd_nl.c:1965:10: warning: implicit conversion from 'enum drbd_state_rv' to 'enum drbd_ret_code' [-Wenum-conversion]
     1965 |  retcode = rv;  /* FIXME: Type mismatch. */
          |          ^
    drivers/block/drbd/drbd_nl.c: In function 'drbd_adm_connect':
    drivers/block/drbd/drbd_nl.c:2690:10: warning: implicit conversion from 'enum drbd_state_rv' to 'enum drbd_ret_code' [-Wenum-conversion]
     2690 |  retcode = conn_request_state(connection, NS(conn, C_UNCONNECTED), CS_VERBOSE);
          |          ^
    drivers/block/drbd/drbd_nl.c: In function 'drbd_adm_disconnect':
    drivers/block/drbd/drbd_nl.c:2803:11: warning: implicit conversion from 'enum drbd_state_rv' to 'enum drbd_ret_code' [-Wenum-conversion]
     2803 |   retcode = rv;  /* FIXME: Type mismatch. */
          |           ^
    
    In each case, both are passed into drbd_adm_finish(), which just takes
    a 32-bit integer and is happy with either, presumably intentionally.
    
    Restructure the code to pass either type directly in there in most
    cases, avoiding the warnings.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Reviewed-by: default avatarChristoph Böhmwalder <christoph.boehmwalder@linbit.com>
    Link: https://lore.kernel.org/r/20220406190715.1938174-3-christoph.boehmwalder@linbit.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
    4b28f3b4
drbd_nl.c 144 KB