soc: bcm: Check for NULL return of devm_kzalloc()
authorQintaoShen <unSimple1993@163.com>
Thu, 24 Mar 2022 08:35:40 +0000 (16:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:23:08 +0000 (10:23 +0200)
commit5650e103bfc70156001615861fb8aafb3947da6e
treebd2140ed4c58e16e6e47cabd474a37416d5ceae1
parent45f1920e26ebebf5611dc1094cb5a511f57f8015
soc: bcm: Check for NULL return of devm_kzalloc()

[ Upstream commit b4bd2aafacce48db26b0a213d849818d940556dd ]

As the potential failure of allocation, devm_kzalloc() may return NULL.  Then
the 'pd->pmb' and the follow lines of code may bring null pointer dereference.

Therefore, it is better to check the return value of devm_kzalloc() to avoid
this confusion.

Fixes: 8bcac4011ebe ("soc: bcm: add PM driver for Broadcom's PMB")
Signed-off-by: QintaoShen <unSimple1993@163.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soc/bcm/bcm63xx/bcm-pmb.c