Skip to content

Commit

Permalink
btrfs: mark btrfs_assertfail() __noreturn
Browse files Browse the repository at this point in the history
Fixes a bunch of warnings including:

  vmlinux.o: warning: objtool: select_reloc_root+0x314: unreachable instruction
  vmlinux.o: warning: objtool: finish_inode_if_needed+0x15b1: unreachable instruction
  vmlinux.o: warning: objtool: get_bio_sector_nr+0x259: unreachable instruction
  vmlinux.o: warning: objtool: raid_wait_read_end_io+0xc26: unreachable instruction
  vmlinux.o: warning: objtool: raid56_parity_alloc_scrub_rbio+0x37b: unreachable instruction
  ...

Reported-by: kernel test robot <[email protected]>
Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Josh Poimboeuf <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
jpoimboe authored and kdave committed Apr 17, 2023
1 parent 8ba7d5f commit f372463
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/btrfs/messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void __cold _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt,
#endif

#ifdef CONFIG_BTRFS_ASSERT
void __cold btrfs_assertfail(const char *expr, const char *file, int line)
void __cold __noreturn btrfs_assertfail(const char *expr, const char *file, int line)
{
pr_err("assertion failed: %s, in %s:%d\n", expr, file, line);
BUG();
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ do { \
} while (0)

#ifdef CONFIG_BTRFS_ASSERT
void __cold btrfs_assertfail(const char *expr, const char *file, int line);
void __cold __noreturn btrfs_assertfail(const char *expr, const char *file, int line);

#define ASSERT(expr) \
(likely(expr) ? (void)0 : btrfs_assertfail(#expr, __FILE__, __LINE__))
Expand Down
1 change: 1 addition & 0 deletions tools/objtool/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
"__reiserfs_panic",
"__stack_chk_fail",
"__ubsan_handle_builtin_unreachable",
"btrfs_assertfail",
"cpu_bringup_and_idle",
"cpu_startup_entry",
"do_exit",
Expand Down

0 comments on commit f372463

Please sign in to comment.