From: Sean Wang <sean.wang@mediatek.com>
To: Wei Yongjun <weiyongjun1@huawei.com>
Cc: "Ryder.Lee" <ryder.lee@mediatek.com>,
Linus Walleij <linus.walleij@linaro.org>,
kernel-janitors@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-mediatek@lists.infradead.org,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH -next] pinctrl: mediatek: moore: fix return value check in mtk_moore_pinctrl_probe()
Date: Fri, 21 Sep 2018 10:01:40 +0800 [thread overview]
Message-ID: <1537495300.9654.2.camel@mtkswgap22> (raw)
In-Reply-To: <1537424510-23623-1-git-send-email-weiyongjun1@huawei.com>
On Thu, 2018-09-20 at 06:21 +0000, Wei Yongjun wrote:
> In case of error, the function devm_kmalloc_array() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.
>
> Fixes: b7d7f9eeca55 ("pinctrl: mediatek: extend struct mtk_pin_desc which per-pin driver depends on")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Sean Wang <sean.wang@mediatek.com>
> ---
> drivers/pinctrl/mediatek/pinctrl-moore.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c
> index c27597c..3bf5dd5 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-moore.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-moore.c
> @@ -608,8 +608,8 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev,
>
> hw->base = devm_kmalloc_array(&pdev->dev, hw->soc->nbase_names,
> sizeof(*hw->base), GFP_KERNEL);
> - if (IS_ERR(hw->base))
> - return PTR_ERR(hw->base);
> + if (!hw->base)
> + return -ENOMEM;
>
> for (i = 0; i < hw->soc->nbase_names; i++) {
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> @@ -629,8 +629,8 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev,
> /* Copy from internal struct mtk_pin_desc to register to the core */
> pins = devm_kmalloc_array(&pdev->dev, hw->soc->npins, sizeof(*pins),
> GFP_KERNEL);
> - if (IS_ERR(pins))
> - return PTR_ERR(pins);
> + if (!pins)
> + return -ENOMEM;
>
> for (i = 0; i < hw->soc->npins; i++) {
> pins[i].number = hw->soc->pins[i].number;
>
next prev parent reply other threads:[~2018-09-21 2:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 6:21 [PATCH -next] pinctrl: mediatek: moore: fix return value check in mtk_moore_pinctrl_probe() Wei Yongjun
2018-09-21 2:01 ` Sean Wang [this message]
[not found] ` <1537424510-23623-1-git-send-email-weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2018-09-21 2:18 ` Sean Wang
2018-09-21 16:08 ` 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=1537495300.9654.2.camel@mtkswgap22 \
--to=sean.wang@mediatek.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=ryder.lee@mediatek.com \
--cc=weiyongjun1@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).