drbd: Mark expected switch fall-throughs
Subsystems (2)
PATCH 1/1 drbd: Mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
In file included from drivers/block/drbd/drbd_actlog.c:30:drivers/block/drbd/drbd_int.h: In function ‘__drbd_chk_io_error_’:drivers/block/drbd/drbd_int.h:1774:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (df == DRBD_READ_ERROR || df == DRBD_WRITE_ERROR) {
^drivers/block/drbd/drbd_int.h:1782:2: note: here
case EP_DETACH:
^~~~drivers/block/drbd/drbd_req.c: In function ‘__req_mod’:drivers/block/drbd/drbd_req.c:856:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (!(req->rq_state & RQ_NET_OK)) {
^ CC [M] fs/btrfs/inode-map.odrivers/block/drbd/drbd_req.c:871:2: note: here
case BARRIER_ACKED:
^~~~
Warning level 3 was used: -Wimplicit-fallthrough=3
Notice that in some cases, the code comment is modified in accordance with what GCC is expecting to find.
This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.
--- drivers/block/drbd/drbd_int.h | 2 +- drivers/block/drbd/drbd_req.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/block/drbd/drbd_int.h +1 -1
@@ -1778,7 +1778,7 @@ static inline void __drbd_chk_io_error_(struct drbd_device *device,_drbd_set_state (_NS (device, disk,D_INCONSISTENT ),CS_HARD ,NULL );break ; } -/* NOTE fall through for DRBD_META_IO_ERROR or DRBD_FORCE_DETACH */ +/* fall through - for DRBD_META_IO_ERROR or DRBD_FORCE_DETACH */ case EP_DETACH :case EP_CALL_HELPER :/* Remember whether we saw a READ or WRITE error.
drivers/block/drbd/drbd_req.c +1 -1
@@ -866,7 +866,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, }/* else: FIXME can this happen? */ break ; } -/* else, fall through to BARRIER_ACKED */ +/* else, fall through - to BARRIER_ACKED */ case BARRIER_ACKED :/* barrier ack for READ requests does not make sense */
Signature · 1 line
2.20.1