summaryrefslogtreecommitdiff
path: root/drivers/soc/bcm
diff options
context:
space:
mode:
authorQintaoShen <unSimple1993@163.com>2022-03-24 11:35:40 +0300
committerFlorian Fainelli <f.fainelli@gmail.com>2022-04-26 19:12:35 +0300
commitb4bd2aafacce48db26b0a213d849818d940556dd (patch)
tree8a25e0ae1ff62fd6a7940d5b5b56a83bbbc94a7e /drivers/soc/bcm
parent3123109284176b1532874591f7c81f3837bbdc17 (diff)
downloadlinux-b4bd2aafacce48db26b0a213d849818d940556dd.tar.xz
soc: bcm: Check for NULL return of devm_kzalloc()
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>
Diffstat (limited to 'drivers/soc/bcm')
-rw-r--r--drivers/soc/bcm/bcm63xx/bcm-pmb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/soc/bcm/bcm63xx/bcm-pmb.c b/drivers/soc/bcm/bcm63xx/bcm-pmb.c
index 7bbe46ea5f94..9407cac47fdb 100644
--- a/drivers/soc/bcm/bcm63xx/bcm-pmb.c
+++ b/drivers/soc/bcm/bcm63xx/bcm-pmb.c
@@ -312,6 +312,9 @@ static int bcm_pmb_probe(struct platform_device *pdev)
for (e = table; e->name; e++) {
struct bcm_pmb_pm_domain *pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
+ if (!pd)
+ return -ENOMEM;
+
pd->pmb = pmb;
pd->data = e;
pd->genpd.name = e->name;