diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2013-10-14 12:14:13 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-11-08 10:59:44 -0500 |
commit | 8077c0d983ab276ec5f2700df56a64d671781905 (patch) | |
tree | 1990b12806eca0a2636f5cb48de5a528a0452244 | |
parent | a207f5937630dd35bd2550620bef416937a1365e (diff) |
bdi: test bdi_init failure
There were two places where return value from bdi_init was not tested.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | fs/char_dev.c | 3 | ||||
-rw-r--r-- | include/linux/backing-dev.h | 4 | ||||
-rw-r--r-- | mm/swap.c | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c index afc2bb691780..b9bc05b9513a 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -574,7 +574,8 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data) | |||
574 | void __init chrdev_init(void) | 574 | void __init chrdev_init(void) |
575 | { | 575 | { |
576 | cdev_map = kobj_map_init(base_probe, &chrdevs_lock); | 576 | cdev_map = kobj_map_init(base_probe, &chrdevs_lock); |
577 | bdi_init(&directly_mappable_cdev_bdi); | 577 | if (bdi_init(&directly_mappable_cdev_bdi)) |
578 | panic("Failed to init directly mappable cdev bdi"); | ||
578 | } | 579 | } |
579 | 580 | ||
580 | 581 | ||
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 5f66d519a726..24819001f5c8 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -109,7 +109,7 @@ struct backing_dev_info { | |||
109 | #endif | 109 | #endif |
110 | }; | 110 | }; |
111 | 111 | ||
112 | int bdi_init(struct backing_dev_info *bdi); | 112 | int __must_check bdi_init(struct backing_dev_info *bdi); |
113 | void bdi_destroy(struct backing_dev_info *bdi); | 113 | void bdi_destroy(struct backing_dev_info *bdi); |
114 | 114 | ||
115 | __printf(3, 4) | 115 | __printf(3, 4) |
@@ -117,7 +117,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, | |||
117 | const char *fmt, ...); | 117 | const char *fmt, ...); |
118 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 118 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
119 | void bdi_unregister(struct backing_dev_info *bdi); | 119 | void bdi_unregister(struct backing_dev_info *bdi); |
120 | int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); | 120 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); |
121 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, | 121 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
122 | enum wb_reason reason); | 122 | enum wb_reason reason); |
123 | void bdi_start_background_writeback(struct backing_dev_info *bdi); | 123 | void bdi_start_background_writeback(struct backing_dev_info *bdi); |
@@ -934,7 +934,8 @@ void __init swap_setup(void) | |||
934 | #ifdef CONFIG_SWAP | 934 | #ifdef CONFIG_SWAP |
935 | int i; | 935 | int i; |
936 | 936 | ||
937 | bdi_init(swapper_spaces[0].backing_dev_info); | 937 | if (bdi_init(swapper_spaces[0].backing_dev_info)) |
938 | panic("Failed to init swap bdi"); | ||
938 | for (i = 0; i < MAX_SWAPFILES; i++) { | 939 | for (i = 0; i < MAX_SWAPFILES; i++) { |
939 | spin_lock_init(&swapper_spaces[i].tree_lock); | 940 | spin_lock_init(&swapper_spaces[i].tree_lock); |
940 | INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear); | 941 | INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear); |