From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Wang Qing <wangqing@vivo.com>, Rob Clark <robdclark@gmail.com>,
Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>,
Daniel Vetter <daniel@ffwll.ch>,
Jordan Crouse <jcrouse@codeaurora.org>,
Jonathan Marek <jonathan@marek.ca>,
Sharat Masetty <smasetty@codeaurora.org>,
Akhil P Oommen <akhilpo@codeaurora.org>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [V2] drm: msm: adreno: use IS_ERR() instead of null pointer check
Date: Sun, 3 Oct 2021 02:43:28 +0300 [thread overview]
Message-ID: <b48957cb-f835-cfa4-34f7-0ab2f96474ed@linaro.org> (raw)
In-Reply-To: <1604719151-28491-1-git-send-email-wangqing@vivo.com>
On 07/11/2020 06:19, Wang Qing wrote:
> a6xx_gmu_get_mmio() never return null in case of error, but ERR_PTR(), so
> we should use IS_ERR() instead of null pointer check and IS_ERR_OR_NULL().
Not quite. a6xx_gmu_get_mmio() can return NULL, as it uses ioremap()
internally. And ioremap returns NULL in case of error. So the proper
check should be IS_ERR_OR_NULL().
>
> Signed-off-by: Wang Qing <wangqing@vivo.com>
> ---
> drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> index 491fee4..82420f7
> --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> @@ -492,7 +492,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
> void __iomem *seqptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc_seq");
> uint32_t pdc_address_offset;
>
> - if (!pdcptr || !seqptr)
> + if (IS_ERR(pdcptr) || IS_ERR(seqptr))
> goto err;
>
> if (adreno_is_a618(adreno_gpu) || adreno_is_a640(adreno_gpu))
> @@ -580,9 +580,9 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
> wmb();
>
> err:
> - if (!IS_ERR_OR_NULL(pdcptr))
> + if (!IS_ERR(pdcptr))
> iounmap(pdcptr);
> - if (!IS_ERR_OR_NULL(seqptr))
> + if (!IS_ERR(seqptr))
> iounmap(seqptr);
> }
>
>
--
With best wishes
Dmitry
next prev parent reply other threads:[~2021-10-02 23:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-07 3:19 [V2] drm: msm: adreno: use IS_ERR() instead of null pointer check Wang Qing
2021-10-02 23:43 ` Dmitry Baryshkov [this message]
2021-10-02 23:52 ` Dmitry Baryshkov
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=b48957cb-f835-cfa4-34f7-0ab2f96474ed@linaro.org \
--to=dmitry.baryshkov@linaro.org \
--cc=airlied@linux.ie \
--cc=akhilpo@codeaurora.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jcrouse@codeaurora.org \
--cc=jonathan@marek.ca \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=smasetty@codeaurora.org \
--cc=wangqing@vivo.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).