summaryrefslogtreecommitdiff
path: root/drivers/md/dm-switch.c
diff options
context:
space:
mode:
authorQianfeng Rong <rongqianfeng@vivo.com>2025-08-06 20:27:04 +0800
committerMikulas Patocka <mpatocka@redhat.com>2025-08-19 11:12:50 +0200
commitc3797175b3673b3a38d59991f7bf4762bce016dd (patch)
tree1a5362d1f6c75337dd7fa8905d85406605d382af /drivers/md/dm-switch.c
parenta3191475d17c19826fff712cbd057032cb079399 (diff)
downloadlinux-c3797175b3673b3a38d59991f7bf4762bce016dd.tar.gz
linux-c3797175b3673b3a38d59991f7bf4762bce016dd.tar.bz2
linux-c3797175b3673b3a38d59991f7bf4762bce016dd.zip
dm: use vmalloc_array() to simplify code
Remove array_size() calls and replace vmalloc() with vmalloc_array() to simplify the code. Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Diffstat (limited to 'drivers/md/dm-switch.c')
-rw-r--r--drivers/md/dm-switch.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/dm-switch.c b/drivers/md/dm-switch.c
index bb1a70b5a215..50a52ca50b34 100644
--- a/drivers/md/dm-switch.c
+++ b/drivers/md/dm-switch.c
@@ -114,8 +114,8 @@ static int alloc_region_table(struct dm_target *ti, unsigned int nr_paths)
return -EINVAL;
}
- sctx->region_table = vmalloc(array_size(nr_slots,
- sizeof(region_table_slot_t)));
+ sctx->region_table = vmalloc_array(nr_slots,
+ sizeof(region_table_slot_t));
if (!sctx->region_table) {
ti->error = "Cannot allocate region table";
return -ENOMEM;