提交 1f8de849 编写于 作者: P Peter Griffin 提交者: Kishon Vijay Abraham I

phy: phy-mvebu-sata: Add missing error check for devm_kzalloc

Currently this driver is missing a check on the return value of devm_kzalloc,
which would cause a NULL pointer dereference in a OOM situation.

This patch adds the aformentioned missing check.
Signed-off-by: NPeter Griffin <peter.griffin@linaro.org>
Acked-by: NAndrew Lunn <andrew@lunn.ch>
Signed-off-by: NKishon Vijay Abraham I <kishon@ti.com>
上级 437a6bc4
......@@ -89,6 +89,8 @@ static int phy_mvebu_sata_probe(struct platform_device *pdev)
struct phy *phy;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->base = devm_ioremap_resource(&pdev->dev, res);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册