Skip to content

Commit 1c3fe2f

Browse files
mauelshaMike Snitzer
authored andcommitted
dm: avoid useless 'else' after 'break' or return'
Signed-off-by: Heinz Mauelshagen <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent ae99111 commit 1c3fe2f

File tree

6 files changed

+38
-38
lines changed

6 files changed

+38
-38
lines changed

drivers/md/dm-stripe.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,11 @@ static int stripe_map_range(struct stripe_c *sc, struct bio *bio,
259259
sc->stripe[target_stripe].physical_start;
260260
bio->bi_iter.bi_size = to_bytes(end - begin);
261261
return DM_MAPIO_REMAPPED;
262-
} else {
263-
/* The range doesn't map to the target stripe */
264-
bio_endio(bio);
265-
return DM_MAPIO_SUBMITTED;
266262
}
263+
264+
/* The range doesn't map to the target stripe */
265+
bio_endio(bio);
266+
return DM_MAPIO_SUBMITTED;
267267
}
268268

269269
static int stripe_map(struct dm_target *ti, struct bio *bio)

drivers/md/dm-thin-metadata.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,8 +1612,8 @@ static int __find_mapped_range(struct dm_thin_device *td,
16121612
if (r) {
16131613
if (r == -ENODATA)
16141614
break;
1615-
else
1616-
return r;
1615+
1616+
return r;
16171617
}
16181618

16191619
if ((lookup.block != pool_end) ||

drivers/md/dm-verity-target.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,24 @@ static int verity_hash_update(struct dm_verity *v, struct ahash_request *req,
110110
sg_init_one(&sg, data, len);
111111
ahash_request_set_crypt(req, &sg, NULL, len);
112112
return crypto_wait_req(crypto_ahash_update(req), wait);
113-
} else {
114-
do {
115-
int r;
116-
size_t this_step = min_t(size_t, len, PAGE_SIZE - offset_in_page(data));
117-
118-
flush_kernel_vmap_range((void *)data, this_step);
119-
sg_init_table(&sg, 1);
120-
sg_set_page(&sg, vmalloc_to_page(data), this_step, offset_in_page(data));
121-
ahash_request_set_crypt(req, &sg, NULL, this_step);
122-
r = crypto_wait_req(crypto_ahash_update(req), wait);
123-
if (unlikely(r))
124-
return r;
125-
data += this_step;
126-
len -= this_step;
127-
} while (len);
128-
return 0;
129113
}
114+
115+
do {
116+
int r;
117+
size_t this_step = min_t(size_t, len, PAGE_SIZE - offset_in_page(data));
118+
119+
flush_kernel_vmap_range((void *)data, this_step);
120+
sg_init_table(&sg, 1);
121+
sg_set_page(&sg, vmalloc_to_page(data), this_step, offset_in_page(data));
122+
ahash_request_set_crypt(req, &sg, NULL, this_step);
123+
r = crypto_wait_req(crypto_ahash_update(req), wait);
124+
if (unlikely(r))
125+
return r;
126+
data += this_step;
127+
len -= this_step;
128+
} while (len);
129+
130+
return 0;
130131
}
131132

132133
/*

drivers/md/dm-writecache.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -623,15 +623,15 @@ static struct wc_entry *writecache_find_entry(struct dm_writecache *wc,
623623
if (unlikely(!node)) {
624624
if (!(flags & WFE_RETURN_FOLLOWING))
625625
return NULL;
626-
if (read_original_sector(wc, e) >= block) {
626+
if (read_original_sector(wc, e) >= block)
627627
return e;
628-
} else {
629-
node = rb_next(&e->rb_node);
630-
if (unlikely(!node))
631-
return NULL;
632-
e = container_of(node, struct wc_entry, rb_node);
633-
return e;
634-
}
628+
629+
node = rb_next(&e->rb_node);
630+
if (unlikely(!node))
631+
return NULL;
632+
633+
e = container_of(node, struct wc_entry, rb_node);
634+
return e;
635635
}
636636
}
637637

drivers/md/persistent-data/dm-btree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,8 +1352,8 @@ static int find_key(struct ro_spine *s, dm_block_t block, bool find_highest,
13521352
i = le32_to_cpu(ro_node(s)->header.nr_entries);
13531353
if (!i)
13541354
return -ENODATA;
1355-
else
1356-
i--;
1355+
1356+
i--;
13571357

13581358
if (find_highest)
13591359
*result_key = le64_to_cpu(ro_node(s)->keys[i]);

drivers/md/persistent-data/dm-space-map-common.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -793,13 +793,12 @@ static int __sm_ll_dec_overflow(struct ll_disk *ll, dm_block_t b,
793793
rc = le32_to_cpu(*v_ptr);
794794
*old_rc = rc;
795795

796-
if (rc == 3) {
796+
if (rc == 3)
797797
return __sm_ll_del_overflow(ll, b, ic);
798-
} else {
799-
rc--;
800-
*v_ptr = cpu_to_le32(rc);
801-
return 0;
802-
}
798+
799+
rc--;
800+
*v_ptr = cpu_to_le32(rc);
801+
return 0;
803802
}
804803

805804
static int sm_ll_dec_overflow(struct ll_disk *ll, dm_block_t b,

0 commit comments

Comments
 (0)