All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhangfei <zhangfei.gao@linaro.org>
To: Axel Lin <axel.lin@ingics.com>, Kishon Vijay Abraham I <kishon@ti.com>
Cc: Jiancheng Xue <xuejiancheng@huawei.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] phy: hix5hd2-sata: Check return value of platform_get_resource
Date: Mon, 02 Mar 2015 16:19:20 +0800	[thread overview]
Message-ID: <54F41D08.8000608@linaro.org> (raw)
In-Reply-To: <1425283854.16106.0.camel@phoenix>



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@ingics.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.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;
>

      reply	other threads:[~2015-03-02  8:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02  8:10 [PATCH] phy: hix5hd2-sata: Check return value of platform_get_resource Axel Lin
2015-03-02  8:19 ` zhangfei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54F41D08.8000608@linaro.org \
    --to=zhangfei.gao@linaro.org \
    --cc=axel.lin@ingics.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xuejiancheng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.