From: Peter Griffin Date: Fri, 15 Aug 2014 12:40:09 +0000 (+0100) Subject: phy: phy-mvebu-sata: Add missing error check for devm_kzalloc X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1f8de849cf8399ff287bab560d04df4515ec73c0;p=sagit-ice-cold%2Fkernel_xiaomi_msm8998.git 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 Acked-by: Andrew Lunn Signed-off-by: Kishon Vijay Abraham I --- 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) 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);