From: Dan Carpenter Date: Tue, 25 Apr 2017 09:19:49 +0000 (+0300) Subject: mtd: oxnas_nand: Allocating more than necessary in probe() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b98e1995e4fa9030474a61ed0dbc033464fe5ea0;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mtd: oxnas_nand: Allocating more than necessary in probe() We only need to allocate sizeof(struct oxnas_nand_ctrl) which is 192 bytes and not sizeof(struct nand_chip) which is a much larger 3056 bytes. Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support") Signed-off-by: Dan Carpenter Acked-by: Neil Armstrong Acked-by: Boris Brezillon Signed-off-by: Brian Norris --- diff --git a/drivers/mtd/nand/oxnas_nand.c b/drivers/mtd/nand/oxnas_nand.c index 3e3bf3b364d2..1b207aac840c 100644 --- a/drivers/mtd/nand/oxnas_nand.c +++ b/drivers/mtd/nand/oxnas_nand.c @@ -91,7 +91,7 @@ static int oxnas_nand_probe(struct platform_device *pdev) int err = 0; /* Allocate memory for the device structure (and zero it) */ - oxnas = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip), + oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas), GFP_KERNEL); if (!oxnas) return -ENOMEM;