mtd: nand: mxs_nand: use calloc() to allocate and clear memory
authorLothar Waßmann <LW@KARO-electronics.de>
Fri, 21 Aug 2015 13:59:50 +0000 (15:59 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 21 Aug 2015 13:59:50 +0000 (15:59 +0200)
drivers/mtd/nand/mxs_nand.c

index e424f60..08847fd 100644 (file)
@@ -1304,12 +1304,11 @@ int board_nand_init(struct nand_chip *nand)
        struct mxs_nand_info *nand_info;
        int err;
 
-       nand_info = malloc(sizeof(struct mxs_nand_info));
+       nand_info = calloc(1, sizeof(struct mxs_nand_info));
        if (!nand_info) {
                printf("MXS NAND: Failed to allocate private data\n");
                return -ENOMEM;
        }
-       memset(nand_info, 0, sizeof(struct mxs_nand_info));
 
        err = mxs_nand_alloc_buffers(nand_info);
        if (err)