]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nvdimm/btt: use sizeof(*pointer) instead of sizeof(type)
authorErick Archer <erick.archer@outlook.com>
Sun, 2 Jun 2024 08:18:23 +0000 (10:18 +0200)
committerIra Weiny <ira.weiny@intel.com>
Mon, 17 Jun 2024 23:39:44 +0000 (18:39 -0500)
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/r/AS8PR02MB72372490C53FB2E35DA1ADD08BFE2@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
drivers/nvdimm/btt.c

index 1e5aedaf8c7bd9c3f9426f1bd7852bf5aa13ad44..b25df8fa8e8e239f1ab6880d21f44afd34a49381 100644 (file)
@@ -751,7 +751,7 @@ static struct arena_info *alloc_arena(struct btt *btt, size_t size,
        u64 logsize, mapsize, datasize;
        u64 available = size;
 
-       arena = kzalloc(sizeof(struct arena_info), GFP_KERNEL);
+       arena = kzalloc(sizeof(*arena), GFP_KERNEL);
        if (!arena)
                return NULL;
        arena->nd_btt = btt->nd_btt;
@@ -978,7 +978,7 @@ static int btt_arena_write_layout(struct arena_info *arena)
        if (ret)
                return ret;
 
-       super = kzalloc(sizeof(struct btt_sb), GFP_NOIO);
+       super = kzalloc(sizeof(*super), GFP_NOIO);
        if (!super)
                return -ENOMEM;