diff options
author | Aliaksei Karaliou <akaraliou.dev@gmail.com> | 2017-12-23 13:27:04 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2018-01-17 17:16:03 +0300 |
commit | 46898e9a7ac9fb2d0d108cc7b753abccbf9d9f20 (patch) | |
tree | 54b0f61af72d0ec85cd12020509eeb03f0923abb /drivers/md/dm-bufio.c | |
parent | bde14184781bd24ee6fb0e1af8d69ca21acbd6e6 (diff) | |
download | linux-46898e9a7ac9fb2d0d108cc7b753abccbf9d9f20.tar.xz |
dm bufio: check result of register_shrinker()
dm_bufio_client_create() does not check result of register_shrinker()
which was tagged as __must_check recently, reported by sparse.
Signed-off-by: Aliaksei Karaliou <akaraliou.dev@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-bufio.c')
-rw-r--r-- | drivers/md/dm-bufio.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 1d130130f264..b98c72fa7322 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -1743,20 +1743,23 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign __free_buffer_wake(b); } + c->shrinker.count_objects = dm_bufio_shrink_count; + c->shrinker.scan_objects = dm_bufio_shrink_scan; + c->shrinker.seeks = 1; + c->shrinker.batch = 0; + r = register_shrinker(&c->shrinker); + if (r) + goto bad_shrinker; + mutex_lock(&dm_bufio_clients_lock); dm_bufio_client_count++; list_add(&c->client_list, &dm_bufio_all_clients); __cache_size_refresh(); mutex_unlock(&dm_bufio_clients_lock); - c->shrinker.count_objects = dm_bufio_shrink_count; - c->shrinker.scan_objects = dm_bufio_shrink_scan; - c->shrinker.seeks = 1; - c->shrinker.batch = 0; - register_shrinker(&c->shrinker); - return c; +bad_shrinker: bad_buffer: bad_cache: while (!list_empty(&c->reserved_buffers)) { |