From: Axel Lin Date: Mon, 2 Mar 2015 08:10:54 +0000 (+0800) Subject: phy: hix5hd2-sata: Check return value of platform_get_resource X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1cbdfc48c3d4064e2515e4d837e714fd1aaa2d6e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git phy: hix5hd2-sata: Check return value of platform_get_resource This prevent NULL pointer dereference if res is NULL. Signed-off-by: Axel Lin Acked-by: Zhangfei Gao Signed-off-by: Kishon Vijay Abraham I --- diff --git a/drivers/phy/phy-hix5hd2-sata.c b/drivers/phy/phy-hix5hd2-sata.c index 34915b4202f1..d6b22659cac1 100644 --- a/drivers/phy/phy-hix5hd2-sata.c +++ b/drivers/phy/phy-hix5hd2-sata.c @@ -147,6 +147,9 @@ static int hix5hd2_sata_phy_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + priv->base = devm_ioremap(dev, res->start, resource_size(res)); if (!priv->base) return -ENOMEM;