Commit 8077c0d9 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Jens Axboe

bdi: test bdi_init failure

There were two places where return value from bdi_init was not tested.
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a207f593
...@@ -574,7 +574,8 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data) ...@@ -574,7 +574,8 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data)
void __init chrdev_init(void) void __init chrdev_init(void)
{ {
cdev_map = kobj_map_init(base_probe, &chrdevs_lock); cdev_map = kobj_map_init(base_probe, &chrdevs_lock);
bdi_init(&directly_mappable_cdev_bdi); if (bdi_init(&directly_mappable_cdev_bdi))
panic("Failed to init directly mappable cdev bdi");
} }
......
...@@ -109,7 +109,7 @@ struct backing_dev_info { ...@@ -109,7 +109,7 @@ struct backing_dev_info {
#endif #endif
}; };
int bdi_init(struct backing_dev_info *bdi); int __must_check bdi_init(struct backing_dev_info *bdi);
void bdi_destroy(struct backing_dev_info *bdi); void bdi_destroy(struct backing_dev_info *bdi);
__printf(3, 4) __printf(3, 4)
...@@ -117,7 +117,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, ...@@ -117,7 +117,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
const char *fmt, ...); const char *fmt, ...);
int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
void bdi_unregister(struct backing_dev_info *bdi); void bdi_unregister(struct backing_dev_info *bdi);
int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); int __must_check bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
enum wb_reason reason); enum wb_reason reason);
void bdi_start_background_writeback(struct backing_dev_info *bdi); void bdi_start_background_writeback(struct backing_dev_info *bdi);
......
...@@ -934,7 +934,8 @@ void __init swap_setup(void) ...@@ -934,7 +934,8 @@ void __init swap_setup(void)
#ifdef CONFIG_SWAP #ifdef CONFIG_SWAP
int i; int i;
bdi_init(swapper_spaces[0].backing_dev_info); if (bdi_init(swapper_spaces[0].backing_dev_info))
panic("Failed to init swap bdi");
for (i = 0; i < MAX_SWAPFILES; i++) { for (i = 0; i < MAX_SWAPFILES; i++) {
spin_lock_init(&swapper_spaces[i].tree_lock); spin_lock_init(&swapper_spaces[i].tree_lock);
INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear); INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear);
......
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