Commit 46898e9a authored by Aliaksei Karaliou's avatar Aliaksei Karaliou Committed by Mike Snitzer

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: default avatarAliaksei Karaliou <akaraliou.dev@gmail.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent bde14184
...@@ -1743,20 +1743,23 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign ...@@ -1743,20 +1743,23 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
__free_buffer_wake(b); __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); mutex_lock(&dm_bufio_clients_lock);
dm_bufio_client_count++; dm_bufio_client_count++;
list_add(&c->client_list, &dm_bufio_all_clients); list_add(&c->client_list, &dm_bufio_all_clients);
__cache_size_refresh(); __cache_size_refresh();
mutex_unlock(&dm_bufio_clients_lock); 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; return c;
bad_shrinker:
bad_buffer: bad_buffer:
bad_cache: bad_cache:
while (!list_empty(&c->reserved_buffers)) { while (!list_empty(&c->reserved_buffers)) {
......
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