Commit c6244b3b authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Ilya Dryomov

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: 3da691bf ("rbd: new request handling code")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent ffdeec7a
...@@ -1404,7 +1404,7 @@ static bool rbd_img_is_write(struct rbd_img_request *img_req) ...@@ -1404,7 +1404,7 @@ static bool rbd_img_is_write(struct rbd_img_request *img_req)
case OBJ_OP_DISCARD: case OBJ_OP_DISCARD:
return true; return true;
default: default:
rbd_assert(0); BUG();
} }
} }
...@@ -2478,7 +2478,7 @@ static bool rbd_obj_handle_write(struct rbd_obj_request *obj_req) ...@@ -2478,7 +2478,7 @@ static bool rbd_obj_handle_write(struct rbd_obj_request *obj_req)
} }
return false; return false;
default: default:
rbd_assert(0); BUG();
} }
} }
...@@ -2506,7 +2506,7 @@ static bool __rbd_obj_handle_request(struct rbd_obj_request *obj_req) ...@@ -2506,7 +2506,7 @@ static bool __rbd_obj_handle_request(struct rbd_obj_request *obj_req)
} }
return false; return false;
default: default:
rbd_assert(0); BUG();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment