mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
dm: avoid assignment in if conditions
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
This commit is contained in:
parent
86a3238c7b
commit
d715fa2357
@ -3416,9 +3416,12 @@ static int crypt_map(struct dm_target *ti, struct bio *bio)
|
||||
if (cc->on_disk_tag_size) {
|
||||
unsigned int tag_len = cc->on_disk_tag_size * (bio_sectors(bio) >> cc->sector_shift);
|
||||
|
||||
if (unlikely(tag_len > KMALLOC_MAX_SIZE) ||
|
||||
unlikely(!(io->integrity_metadata = kmalloc(tag_len,
|
||||
GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN)))) {
|
||||
if (unlikely(tag_len > KMALLOC_MAX_SIZE))
|
||||
io->integrity_metadata = NULL;
|
||||
else
|
||||
io->integrity_metadata = kmalloc(tag_len, GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN);
|
||||
|
||||
if (unlikely(!io->integrity_metadata)) {
|
||||
if (bio_sectors(bio) > cc->tag_pool_max_sectors)
|
||||
dm_accept_partial_bio(bio, cc->tag_pool_max_sectors);
|
||||
io->integrity_metadata = mempool_alloc(&cc->tag_pool, GFP_NOIO);
|
||||
|
@ -1046,7 +1046,8 @@ static int message_stats_create(struct mapped_device *md,
|
||||
else if (!strncasecmp(a, "histogram:", 10)) {
|
||||
if (n_histogram_entries)
|
||||
goto ret_einval;
|
||||
if ((r = parse_histogram(a + 10, &n_histogram_entries, &histogram_boundaries)))
|
||||
r = parse_histogram(a + 10, &n_histogram_entries, &histogram_boundaries);
|
||||
if (r)
|
||||
goto ret;
|
||||
} else
|
||||
goto ret_einval;
|
||||
|
@ -374,7 +374,8 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
|
||||
if (!dd)
|
||||
return -ENOMEM;
|
||||
|
||||
if ((r = dm_get_table_device(t->md, dev, mode, &dd->dm_dev))) {
|
||||
r = dm_get_table_device(t->md, dev, mode, &dd->dm_dev);
|
||||
if (r) {
|
||||
kfree(dd);
|
||||
return r;
|
||||
}
|
||||
|
@ -1832,10 +1832,13 @@ static void __writecache_writeback_pmem(struct dm_writecache *wc, struct writeba
|
||||
wb->wc = wc;
|
||||
bio->bi_end_io = writecache_writeback_endio;
|
||||
bio->bi_iter.bi_sector = read_original_sector(wc, e);
|
||||
if (max_pages <= WB_LIST_INLINE ||
|
||||
unlikely(!(wb->wc_list = kmalloc_array(max_pages, sizeof(struct wc_entry *),
|
||||
GFP_NOIO | __GFP_NORETRY |
|
||||
__GFP_NOMEMALLOC | __GFP_NOWARN)))) {
|
||||
|
||||
if (unlikely(max_pages > WB_LIST_INLINE))
|
||||
wb->wc_list = kmalloc_array(max_pages, sizeof(struct wc_entry *),
|
||||
GFP_NOIO | __GFP_NORETRY |
|
||||
__GFP_NOMEMALLOC | __GFP_NOWARN);
|
||||
|
||||
if (likely(max_pages <= WB_LIST_INLINE) || unlikely(!wb->wc_list)) {
|
||||
wb->wc_list = wb->wc_list_inline;
|
||||
max_pages = WB_LIST_INLINE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user