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: 8bcac4011e
("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>
This commit is contained in:
parent
3123109284
commit
b4bd2aafac
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue