[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54F41D08.8000608@linaro.org>
Date: Mon, 02 Mar 2015 16:19:20 +0800
From: zhangfei <zhangfei.gao@...aro.org>
To: Axel Lin <axel.lin@...ics.com>,
Kishon Vijay Abraham I <kishon@...com>
CC: Jiancheng Xue <xuejiancheng@...wei.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] phy: hix5hd2-sata: Check return value of platform_get_resource
On 03/02/2015 04:10 PM, Axel Lin wrote:
> This prevent NULL pointer dereference if res is NULL.
>
> Signed-off-by: Axel Lin <axel.lin@...ics.com>
Acked-by: Zhangfei Gao <zhangfei.gao@...aro.org>
Thanks
> ---
> This patch replaces [PATCH] phy: hix5hd2-sata: Convert to use devm_ioremap_resource,
> as zhangfei pinted out that the memory region is shared with sata controller so
> devm_request_mem_region would fail.
> drivers/phy/phy-hix5hd2-sata.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/phy/phy-hix5hd2-sata.c b/drivers/phy/phy-hix5hd2-sata.c
> index 34915b4..d6b2265 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;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists