Skip to content
  • Ming Lei's avatar
    d82e557c
    drbd: fix function cast warnings in state machine · d82e557c
    Ming Lei authored
    JIRA: https://issues.redhat.com/browse/RHEL-56837
    
    
    
    commit fe0b1e9a73d60f01fdc391925be74e823af7c91d
    Author: Arnd Bergmann <arnd@arndb.de>
    Date:   Tue Feb 13 11:03:01 2024 +0100
    
        drbd: fix function cast warnings in state machine
    
        There are four state machines in drbd that use a common infrastructure, with
        a cast to an incompatible function type in REMEMBER_STATE_CHANGE that clang-16
        now warns about:
    
        drivers/block/drbd/drbd_state.c:1632:3: error: cast from 'int (*)(struct sk_buff *, unsigned int, struct drbd_resource_state_change *, enum drbd_notification_type)' to 'typeof (last_func)' (aka 'int (*)(struct sk_buff *, unsigned int, void *, enum drbd_notification_type)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
         1632 |                 REMEMBER_STATE_CHANGE(notify_resource_state_change,
              |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         1633 |                                       resource_state_change, NOTIFY_CHANGE);
              |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        drivers/block/drbd/drbd_state.c:1619:17: note: expanded from macro 'REMEMBER_STATE_CHANGE'
         1619 |            last_func = (typeof(last_func))func; \
              |                        ^~~~~~~~~~~~~~~~~~~~~~~
        drivers/block/drbd/drbd_state.c:1641:4: error: cast from 'int (*)(struct sk_buff *, unsigned int, struct drbd_connection_state_change *, enum drbd_notification_type)' to 'typeof (last_func)' (aka 'int (*)(struct sk_buff *, unsigned int, void *, enum drbd_notification_type)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
         1641 |                         REMEMBER_STATE_CHANGE(notify_connection_state_change,
              |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         1642 |                                               connection_state_change, NOTIFY_CHANGE);
              |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        Change these all to actually expect a void pointer to be passed, which
        matches the caller.
    
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
        Link: https://lore.kernel.org/r/20240213100354.457128-1-arnd@kernel.org
    
    
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    
    Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
    d82e557c
    drbd: fix function cast warnings in state machine
    Ming Lei authored
    JIRA: https://issues.redhat.com/browse/RHEL-56837
    
    
    
    commit fe0b1e9a73d60f01fdc391925be74e823af7c91d
    Author: Arnd Bergmann <arnd@arndb.de>
    Date:   Tue Feb 13 11:03:01 2024 +0100
    
        drbd: fix function cast warnings in state machine
    
        There are four state machines in drbd that use a common infrastructure, with
        a cast to an incompatible function type in REMEMBER_STATE_CHANGE that clang-16
        now warns about:
    
        drivers/block/drbd/drbd_state.c:1632:3: error: cast from 'int (*)(struct sk_buff *, unsigned int, struct drbd_resource_state_change *, enum drbd_notification_type)' to 'typeof (last_func)' (aka 'int (*)(struct sk_buff *, unsigned int, void *, enum drbd_notification_type)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
         1632 |                 REMEMBER_STATE_CHANGE(notify_resource_state_change,
              |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         1633 |                                       resource_state_change, NOTIFY_CHANGE);
              |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        drivers/block/drbd/drbd_state.c:1619:17: note: expanded from macro 'REMEMBER_STATE_CHANGE'
         1619 |            last_func = (typeof(last_func))func; \
              |                        ^~~~~~~~~~~~~~~~~~~~~~~
        drivers/block/drbd/drbd_state.c:1641:4: error: cast from 'int (*)(struct sk_buff *, unsigned int, struct drbd_connection_state_change *, enum drbd_notification_type)' to 'typeof (last_func)' (aka 'int (*)(struct sk_buff *, unsigned int, void *, enum drbd_notification_type)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
         1641 |                         REMEMBER_STATE_CHANGE(notify_connection_state_change,
              |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         1642 |                                               connection_state_change, NOTIFY_CHANGE);
              |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        Change these all to actually expect a void pointer to be passed, which
        matches the caller.
    
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
        Link: https://lore.kernel.org/r/20240213100354.457128-1-arnd@kernel.org
    
    
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    
    Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Loading