diff options
author | Peter Griffin <peter.griffin@linaro.org> | 2014-08-15 08:40:09 -0400 |
---|---|---|
committer | Kishon Vijay Abraham I <kishon@ti.com> | 2014-09-24 05:48:31 -0400 |
commit | 1f8de849cf8399ff287bab560d04df4515ec73c0 (patch) | |
tree | 8400cf883a301832560187933eade98faa8a1e58 /drivers/phy | |
parent | 437a6bc478e6530efad9aeb04b84b2f5c4e356d5 (diff) |
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: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/phy-mvebu-sata.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/phy/phy-mvebu-sata.c b/drivers/phy/phy-mvebu-sata.c index cc3c0e166daf..10bb8e5aa940 100644 --- a/drivers/phy/phy-mvebu-sata.c +++ b/drivers/phy/phy-mvebu-sata.c | |||
@@ -89,6 +89,8 @@ static int phy_mvebu_sata_probe(struct platform_device *pdev) | |||
89 | struct phy *phy; | 89 | struct phy *phy; |
90 | 90 | ||
91 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); | 91 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
92 | if (!priv) | ||
93 | return -ENOMEM; | ||
92 | 94 | ||
93 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 95 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
94 | priv->base = devm_ioremap_resource(&pdev->dev, res); | 96 | priv->base = devm_ioremap_resource(&pdev->dev, res); |