projects
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0fd96bf
)
reset: mediatek: check malloc return valaue before use
author
Weijie Gao
<weijie.gao@mediatek.com>
Wed, 19 Jul 2023 09:16:11 +0000
(17:16 +0800)
committer
Tom Rini
<trini@konsulko.com>
Thu, 3 Aug 2023 13:40:49 +0000
(09:40 -0400)
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>
drivers/reset/reset-mediatek.c
patch
|
blob
|
history
diff --git
a/drivers/reset/reset-mediatek.c
b/drivers/reset/reset-mediatek.c
index 8b62d917778bc7cd5137f63f04afd56421006f06..97ed221f739a939f614b8f466ef1fad7da1e652d 100644
(file)
--- a/
drivers/reset/reset-mediatek.c
+++ b/
drivers/reset/reset-mediatek.c
@@
-79,6
+79,9
@@
int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs)
return ret;
priv = malloc(sizeof(struct mediatek_reset_priv));
+ if (!priv)
+ return -ENOMEM;
+
priv->regofs = regofs;
priv->nr_resets = num_regs * 32;
dev_set_priv(rst_dev, priv);