From: Amitoj Kaur Chawla Date: Fri, 12 Feb 2016 08:39:49 +0000 (+0530) Subject: staging: goldfish: goldfish_nand: Return correct error code X-Git-Tag: v5.15~14007^2~819 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=814625b539d36d57cb06f412714ec31d7fcd23db;p=platform%2Fkernel%2Flinux-starfive.git staging: goldfish: goldfish_nand: Return correct error code The return value of devm_kzalloc on failure of allocation of memory should be -ENOMEM and not -1. Found using Coccinelle. A simplified version of the semantic patch used is: // @@ expression *e; @@ e = devm_kzalloc(...); if (e == NULL) { ... return - -1 + -ENOMEM ; } // The single call site does not perform any checks on the return value, hence no change is required at the call site. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/goldfish/goldfish_nand.c b/drivers/staging/goldfish/goldfish_nand.c index 623353db5..5c4f61c 100644 --- a/drivers/staging/goldfish/goldfish_nand.c +++ b/drivers/staging/goldfish/goldfish_nand.c @@ -290,7 +290,7 @@ static int nand_setup_cmd_params(struct platform_device *pdev, nand->cmd_params = devm_kzalloc(&pdev->dev, sizeof(struct cmd_params), GFP_KERNEL); if (!nand->cmd_params) - return -1; + return -ENOMEM; paddr = __pa(nand->cmd_params); writel((u32)(paddr >> 32), base + NAND_CMD_PARAMS_ADDR_HIGH);