Commit 1cbdfc48 authored by Axel Lin's avatar Axel Lin Committed by Kishon Vijay Abraham I

phy: hix5hd2-sata: Check return value of platform_get_resource

This prevent NULL pointer dereference if res is NULL.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avatarZhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent 0f9722e3
...@@ -147,6 +147,9 @@ static int hix5hd2_sata_phy_probe(struct platform_device *pdev) ...@@ -147,6 +147,9 @@ static int hix5hd2_sata_phy_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -EINVAL;
priv->base = devm_ioremap(dev, res->start, resource_size(res)); priv->base = devm_ioremap(dev, res->start, resource_size(res));
if (!priv->base) if (!priv->base)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment