* [PATCH] drm: Use IS_ERR() instead of null pointer check
@ 2020-11-06 2:31 Wang Qing
2020-11-06 18:52 ` Sam Ravnborg
0 siblings, 1 reply; 2+ messages in thread
From: Wang Qing @ 2020-11-06 2:31 UTC (permalink / raw)
To: Rob Clark, Sean Paul, David Airlie, Daniel Vetter, Jordan Crouse,
Jonathan Marek, Akhil P Oommen, Sharat Masetty, linux-arm-msm,
dri-devel, freedreno, linux-kernel
Cc: Wang Qing
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
Signed-off-by: Wang Qing <wangqing@vivo.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 491fee4..8c81a89
--- 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))
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm: Use IS_ERR() instead of null pointer check
2020-11-06 2:31 [PATCH] drm: Use IS_ERR() instead of null pointer check Wang Qing
@ 2020-11-06 18:52 ` Sam Ravnborg
0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2020-11-06 18:52 UTC (permalink / raw)
To: Wang Qing
Cc: freedreno, Jonathan Marek, David Airlie, linux-arm-msm,
Sharat Masetty, dri-devel, Akhil P Oommen, Sean Paul,
linux-kernel
Hi Wang.
Thanks for the fix.
On Fri, Nov 06, 2020 at 10:31:19AM +0800, 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
>
> Signed-off-by: Wang Qing <wangqing@vivo.com>
In the future please put "drm/<driver-dir>:" in the subject.
See git log . in said directory for normal practice - this let the
readers see this is an msm related patch.
> ---
> drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> index 491fee4..8c81a89
> --- 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;
When the pointer is checked after the err: label the function
IS_ERR_OR_NULL() is used. Please update both places so they match.
Sam
>
> if (adreno_is_a618(adreno_gpu) || adreno_is_a640(adreno_gpu))
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-06 18:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06 2:31 [PATCH] drm: Use IS_ERR() instead of null pointer check Wang Qing
2020-11-06 18:52 ` Sam Ravnborg
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).