From: Jia-Ju Bai Date: Fri, 25 Feb 2022 13:25:52 +0000 (-0800) Subject: memory: emif: check the pointer temp in get_device_details() X-Git-Tag: v6.1-rc5~1756^2~3^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b5ab1bfa1898c6d52936a57c25c5ceba2cb2f87;p=platform%2Fkernel%2Flinux-starfive.git memory: emif: check the pointer temp in get_device_details() The pointer temp is allocated by devm_kzalloc(), so it should be checked for error handling. Fixes: 7ec944538dde ("memory: emif: add basic infrastructure for EMIF driver") Signed-off-by: Jia-Ju Bai Link: https://lore.kernel.org/r/20220225132552.27894-1-baijiaju1990@gmail.com Signed-off-by: Krzysztof Kozlowski --- diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index d4d4044..ecc78d6 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -1025,7 +1025,7 @@ static struct emif_data *__init_or_module get_device_details( temp = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); dev_info = devm_kzalloc(dev, sizeof(*dev_info), GFP_KERNEL); - if (!emif || !pd || !dev_info) { + if (!emif || !temp || !dev_info) { dev_err(dev, "%s:%d: allocation error\n", __func__, __LINE__); goto error; }