Skip to content

Commit

Permalink
memory: emif: check the pointer temp in get_device_details()
Browse files Browse the repository at this point in the history
[ Upstream commit 5b5ab1b ]

The pointer temp is allocated by devm_kzalloc(), so it should be
checked for error handling.

Fixes: 7ec9445 ("memory: emif: add basic infrastructure for EMIF driver")
Signed-off-by: Jia-Ju Bai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
XidianGeneral authored and gregkh committed Apr 8, 2022
1 parent 9003e8d commit 3d163f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/memory/emif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3d163f4

Please sign in to comment.