mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-22 20:58:22 +00:00
reset: mediatek: check malloc return valaue before use
This patch add missing return value check for allocating the driver's private data. -ENOMEM will be returned if malloc() fails. Signed-off-by: Sam Shih <sam.shih@mediatek.com> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
This commit is contained in:
parent
0fd96bf224
commit
6f1cc261b9
1 changed files with 3 additions and 0 deletions
|
@ -79,6 +79,9 @@ int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
priv = malloc(sizeof(struct mediatek_reset_priv));
|
priv = malloc(sizeof(struct mediatek_reset_priv));
|
||||||
|
if (!priv)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
priv->regofs = regofs;
|
priv->regofs = regofs;
|
||||||
priv->nr_resets = num_regs * 32;
|
priv->nr_resets = num_regs * 32;
|
||||||
dev_set_priv(rst_dev, priv);
|
dev_set_priv(rst_dev, priv);
|
||||||
|
|
Loading…
Add table
Reference in a new issue