diff options
author | Chengguang Xu <cgxu519@gmx.com> | 2018-09-17 23:34:21 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-18 13:21:26 +0200 |
commit | f8499d6edc0890eaa72e2d88a1415dbb8d4e82c8 (patch) | |
tree | a562d6f430359ee880e45f18fd43d5553d1cb8b4 /drivers/staging/erofs/internal.h | |
parent | 7dc074348eb85d48f7a1fa96879458f4becf68a7 (diff) | |
download | linux-f8499d6edc0890eaa72e2d88a1415dbb8d4e82c8.tar.bz2 |
staging: erofs: code cleanup for erofs_kmalloc()
Define a dummy function of time_to_inject()/erofs_show_injection_info(),
so that we don't have to check macro CONFIG_EROFS_FAULT_INJECTION in
calling place.
Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/erofs/internal.h')
-rw-r--r-- | drivers/staging/erofs/internal.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/staging/erofs/internal.h b/drivers/staging/erofs/internal.h index f20c6e9b7471..0011b9d505fd 100644 --- a/drivers/staging/erofs/internal.h +++ b/drivers/staging/erofs/internal.h @@ -42,12 +42,12 @@ #define DBG_BUGON(...) ((void)0) #endif -#ifdef CONFIG_EROFS_FAULT_INJECTION enum { FAULT_KMALLOC, FAULT_MAX, }; +#ifdef CONFIG_EROFS_FAULT_INJECTION extern char *erofs_fault_name[FAULT_MAX]; #define IS_FAULT_SET(fi, type) ((fi)->inject_type & (1 << (type))) @@ -143,17 +143,24 @@ static inline bool time_to_inject(struct erofs_sb_info *sbi, int type) } return false; } +#else +static inline bool time_to_inject(struct erofs_sb_info *sbi, int type) +{ + return false; +} + +static inline void erofs_show_injection_info(int type) +{ +} #endif static inline void *erofs_kmalloc(struct erofs_sb_info *sbi, size_t size, gfp_t flags) { -#ifdef CONFIG_EROFS_FAULT_INJECTION if (time_to_inject(sbi, FAULT_KMALLOC)) { erofs_show_injection_info(FAULT_KMALLOC); return NULL; } -#endif return kmalloc(size, flags); } |