Skip to content

Commit c6244b3

Browse files
arndbidryomov
authored andcommitted
rbd: avoid Wreturn-type warnings
In some configurations gcc cannot see that rbd_assert(0) leads to an unreachable code path: drivers/block/rbd.c: In function 'rbd_img_is_write': drivers/block/rbd.c:1397:1: error: control reaches end of non-void function [-Werror=return-type] drivers/block/rbd.c: In function '__rbd_obj_handle_request': drivers/block/rbd.c:2499:1: error: control reaches end of non-void function [-Werror=return-type] drivers/block/rbd.c: In function 'rbd_obj_handle_write': drivers/block/rbd.c:2471:1: error: control reaches end of non-void function [-Werror=return-type] As the rbd_assert() here shows has no extra information beyond the verbose BUG(), we can simply use BUG() directly in its place. This is reliably detected as not returning on any architecture, since it doesn't depend on the unlikely() comparison that confused gcc. Fixes: 3da691b ("rbd: new request handling code") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Ilya Dryomov <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent ffdeec7 commit c6244b3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/block/rbd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ static bool rbd_img_is_write(struct rbd_img_request *img_req)
14041404
case OBJ_OP_DISCARD:
14051405
return true;
14061406
default:
1407-
rbd_assert(0);
1407+
BUG();
14081408
}
14091409
}
14101410

@@ -2478,7 +2478,7 @@ static bool rbd_obj_handle_write(struct rbd_obj_request *obj_req)
24782478
}
24792479
return false;
24802480
default:
2481-
rbd_assert(0);
2481+
BUG();
24822482
}
24832483
}
24842484

@@ -2506,7 +2506,7 @@ static bool __rbd_obj_handle_request(struct rbd_obj_request *obj_req)
25062506
}
25072507
return false;
25082508
default:
2509-
rbd_assert(0);
2509+
BUG();
25102510
}
25112511
}
25122512

0 commit comments

Comments
 (0)