Commit fe0b1e9
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: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240213100354.457128-1-arnd@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 7789bf0 commit fe0b1e9
2 files changed
+18
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1542 | 1542 | | |
1543 | 1543 | | |
1544 | 1544 | | |
1545 | | - | |
| 1545 | + | |
1546 | 1546 | | |
1547 | 1547 | | |
| 1548 | + | |
1548 | 1549 | | |
1549 | 1550 | | |
1550 | 1551 | | |
| |||
1558 | 1559 | | |
1559 | 1560 | | |
1560 | 1561 | | |
1561 | | - | |
| 1562 | + | |
1562 | 1563 | | |
1563 | 1564 | | |
1564 | | - | |
| 1565 | + | |
| 1566 | + | |
1565 | 1567 | | |
1566 | | - | |
1567 | | - | |
| 1568 | + | |
| 1569 | + | |
1568 | 1570 | | |
1569 | 1571 | | |
1570 | 1572 | | |
1571 | 1573 | | |
1572 | 1574 | | |
1573 | 1575 | | |
1574 | 1576 | | |
1575 | | - | |
| 1577 | + | |
1576 | 1578 | | |
1577 | 1579 | | |
| 1580 | + | |
1578 | 1581 | | |
1579 | 1582 | | |
1580 | 1583 | | |
| |||
1585 | 1588 | | |
1586 | 1589 | | |
1587 | 1590 | | |
1588 | | - | |
| 1591 | + | |
1589 | 1592 | | |
1590 | 1593 | | |
| 1594 | + | |
1591 | 1595 | | |
1592 | 1596 | | |
1593 | 1597 | | |
| |||
1605 | 1609 | | |
1606 | 1610 | | |
1607 | 1611 | | |
1608 | | - | |
1609 | | - | |
| 1612 | + | |
| 1613 | + | |
1610 | 1614 | | |
1611 | 1615 | | |
1612 | 1616 | | |
| |||
1616 | 1620 | | |
1617 | 1621 | | |
1618 | 1622 | | |
1619 | | - | |
| 1623 | + | |
1620 | 1624 | | |
1621 | 1625 | | |
1622 | 1626 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
0 commit comments