From: Krzysztof Kozlowski <krzk@kernel.org>
To: Andrzej Hajda <a.hajda@samsung.com>
Cc: Tomasz Figa <tomasz.figa@gmail.com>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH] pinctrl: samsung: Fix memory mapping code
Date: Wed, 22 Feb 2017 19:02:02 +0200 [thread overview]
Message-ID: <20170222170202.heu35anyoziwv23n@kozik-lap> (raw)
In-Reply-To: <1487749442-23806-1-git-send-email-a.hajda@samsung.com>
On Wed, Feb 22, 2017 at 08:44:02AM +0100, Andrzej Hajda wrote:
> Some pinctrls share memory regions, and devm_ioremap_resource does not
> allow to share resources, in opposition to devm_ioremap.
> This patch restores back usage of devm_ioremap function, but with proper
> error handling and logging.
>
> Fixes: baafaca ("pinctrl: samsung: Fix return value check in samsung_pinctrl_get_soc_data()")
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
> drivers/pinctrl/samsung/pinctrl-samsung.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
> index f9ddba7..ebecff8 100644
> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
> @@ -988,9 +988,12 @@ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d,
>
> for (i = 0; i < ctrl->nr_ext_resources + 1; i++) {
> res = platform_get_resource(pdev, IORESOURCE_MEM, i);
> - virt_base[i] = devm_ioremap_resource(&pdev->dev, res);
> - if (IS_ERR(virt_base[i]))
> - return ERR_CAST(virt_base[i]);
> + virt_base[i] = devm_ioremap(&pdev->dev, res->start,
> + resource_size(res));
A little bit out of scope of this patch: don't we need here a check
for if (!res)? With devm_ioremap_resource it wasn't needed but
platform_get_resource might return NULL and here you are dereferencing
it.
This might be though a separate patch as you try to revert broken
behavior to previous code.
Best regards,
Krzysztof
> + if (!virt_base[i]) {
> + dev_err(&pdev->dev, "failed to ioremap %pR\n", res);
> + return ERR_PTR(-EIO);
> + }
> }
>
> bank = d->pin_banks;
> --
> 2.7.4
>
next prev parent reply other threads:[~2017-02-22 17:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170222074421eucas1p17bbab9c297450bca1c5908ada16d2fa6@eucas1p1.samsung.com>
2017-02-22 7:44 ` [PATCH] pinctrl: samsung: Fix memory mapping code Andrzej Hajda
2017-02-22 7:59 ` Marek Szyprowski
2017-02-22 17:02 ` Krzysztof Kozlowski [this message]
2017-02-23 10:12 ` [PATCH v2] " Andrzej Hajda
2017-02-23 11:37 ` Krzysztof Kozlowski
2017-03-14 13:35 ` Linus Walleij
2017-03-14 14:28 ` Andrzej Hajda
2017-03-15 13:44 ` Linus Walleij
2017-03-15 13:43 ` Linus Walleij
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=20170222170202.heu35anyoziwv23n@kozik-lap \
--to=krzk@kernel.org \
--cc=a.hajda@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=s.nawrocki@samsung.com \
--cc=tomasz.figa@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox