]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
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 e424f60a9a05642c7d92cd52578a0dd06bd46f5c..08847fd8e28bd7a1164d45179c473f97bfd28594 100644 (file)
@@ -1304,12 +1304,11 @@ int board_nand_init(struct nand_chip *nand)
        struct mxs_nand_info *nand_info;
        int err;
 
        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;
        }
        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)
 
        err = mxs_nand_alloc_buffers(nand_info);
        if (err)