soc: ti: ti_sci_pm_domains: Check for null return of devm_kcalloc
authorQintaoShen <unSimple1993@163.com>
Thu, 24 Mar 2022 07:44:03 +0000 (15:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:22:41 +0000 (10:22 +0200)
commit7cef9274fa1b8506949d74bc45aef072b890824a
treeae0e0d6a27263de466e0c8e230986e83b556c567
parenteee44c7268421a9fd5bc33662d8751b4cc316301
soc: ti: ti_sci_pm_domains: Check for null return of devm_kcalloc

[ Upstream commit ba56291e297d28aa6eb82c5c1964fae2d7594746 ]

The allocation funciton devm_kcalloc may fail and return a null pointer,
which would cause a null-pointer dereference later.
It might be better to check it and directly return -ENOMEM just like the
usage of devm_kcalloc in previous code.

Signed-off-by: QintaoShen <unSimple1993@163.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Link: https://lore.kernel.org/r/1648107843-29077-1-git-send-email-unSimple1993@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soc/ti/ti_sci_pm_domains.c