]> Git Repo - linux.git/blobdiff - drivers/mtd/sm_ftl.c
Merge tag 'nvme-for-4.18' of git://git.infradead.org/nvme
[linux.git] / drivers / mtd / sm_ftl.c
index 79636349df965a4c67c1db5feeb2ac3f159bbdeb..f3bd86e136033d80e791fc996f0d9516d5e54d48 100644 (file)
@@ -82,7 +82,7 @@ static struct attribute_group *sm_create_sysfs_attributes(struct sm_ftl *ftl)
 
 
        /* Create array of pointers to the attributes */
-       attributes = kzalloc(sizeof(struct attribute *) * (NUM_ATTRIBUTES + 1),
+       attributes = kcalloc(NUM_ATTRIBUTES + 1, sizeof(struct attribute *),
                                                                GFP_KERNEL);
        if (!attributes)
                goto error3;
@@ -750,7 +750,7 @@ static int sm_init_zone(struct sm_ftl *ftl, int zone_num)
        dbg("initializing zone %d", zone_num);
 
        /* Allocate memory for FTL table */
-       zone->lba_to_phys_table = kmalloc(ftl->max_lba * 2, GFP_KERNEL);
+       zone->lba_to_phys_table = kmalloc_array(ftl->max_lba, 2, GFP_KERNEL);
 
        if (!zone->lba_to_phys_table)
                return -ENOMEM;
@@ -1137,7 +1137,7 @@ static void sm_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
                goto error2;
 
        /* Allocate zone array, it will be initialized on demand */
-       ftl->zones = kzalloc(sizeof(struct ftl_zone) * ftl->zone_count,
+       ftl->zones = kcalloc(ftl->zone_count, sizeof(struct ftl_zone),
                                                                GFP_KERNEL);
        if (!ftl->zones)
                goto error3;
This page took 0.024851 seconds and 4 git commands to generate.