Skip to contentSkip to conversation

drm: msm: adreno: Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) +PTR_ERR

PATCH Applied Mamta Shukla 5 participants 6 messages Oct 18, 2018 – Oct 23, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: msm: adreno: Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) +PTR_ERR

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR because its better to have inlined function rather than code-opened implementation.

---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +1 -4
index 6a68493..b751b76 100644
@@ -1222,10 +1222,7 @@ static int a5xx_crashdumper_init(struct msm_gpu *gpu,
 		SZ_1M, MSM_BO_UNCACHED, gpu->aspace,
 		&dumper->bo, &dumper->iova);
 
-	if (IS_ERR(dumper->ptr))
-		return PTR_ERR(dumper->ptr);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(dumper->ptr);
 }
 
 static void a5xx_crashdumper_free(struct msm_gpu *gpu,
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 2 lines · Mamta Shukla

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR because its better to have inlined function rather than code-opened implementation.

Just for your information, people have mixed feelings about this. In your case, it's probably fine, because this is the only if in the function. But when there is a series of if (...) return; followed by a return 0; at the end, people ofen prefer to keep it as it is, so the last case doesn't look different than the others.

julia

Quoted 32 lines
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +1 -5
index 6a68493..b751b76 100644
@@ -1222,10 +1222,7 @@ static int a5xx_crashdumper_init(struct msm_gpu *gpu,
 		SZ_1M, MSM_BO_UNCACHED, gpu->aspace,
 		&dumper->bo, &dumper->iova);
 
-	if (IS_ERR(dumper->ptr))
-		return PTR_ERR(dumper->ptr);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(dumper->ptr);
 }
 
 static void a5xx_crashdumper_free(struct msm_gpu *gpu,
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20181018204815.GA23390%40armorer.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 10 lines · Julia Lawall
Quoted 2 lines · Mamta Shukla

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR because its better to have inlined function rather than code-opened implementation.

Just for your information, people have mixed feelings about this. In your case, it's probably fine, because this is the only if in the function. But when there is a series of if (...) return; followed by a return 0; at the end, people ofen prefer to keep it as it is, so the last case doesn't look different than the others.

Yeah I asked the maintainer for this driver for an ack, the other patches look good, will merged them as soon as I have the answer for this one here.

Mamta, since you'll have a few things merged already with these I think it's a good time to start looking into bigger tasks and figuring out what you might want to do in your internship:

https://dri.freedesktop.org/docs/drm/gpu/todo.html

Since this todo list is very unstructured it's best to discuss a bit over irc what you would want to, and what makes sense as an internship.

Thanks, Daniel

Quoted 35 lines

julia

Quoted 32 lines
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +1 -5
index 6a68493..b751b76 100644
@@ -1222,10 +1222,7 @@ static int a5xx_crashdumper_init(struct msm_gpu *gpu,
 		SZ_1M, MSM_BO_UNCACHED, gpu->aspace,
 		&dumper->bo, &dumper->iova);
 
-	if (IS_ERR(dumper->ptr))
-		return PTR_ERR(dumper->ptr);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(dumper->ptr);
 }
 
 static void a5xx_crashdumper_free(struct msm_gpu *gpu,
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20181018204815.GA23390%40armorer.
For more options, visit https://groups.google.com/d/optout.

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#3 lore raw
Quoted 20 lines · Daniel Vetter
Quoted 10 lines · Julia Lawall
Quoted 2 lines · Mamta Shukla

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR because its better to have inlined function rather than code-opened implementation.

Just for your information, people have mixed feelings about this. In your case, it's probably fine, because this is the only if in the function. But when there is a series of if (...) return; followed by a return 0; at the end, people ofen prefer to keep it as it is, so the last case doesn't look different than the others.

Yeah I asked the maintainer for this driver for an ack, the other patches look good, will merged them as soon as I have the answer for this one here.

Mamta, since you'll have a few things merged already with these I think it's a good time to start looking into bigger tasks and figuring out what you might want to do in your internship:

Quoted 9 lines

https://dri.freedesktop.org/docs/drm/gpu/todo.html

Since this todo list is very unstructured it's best to discuss a bit over irc what you would want to, and what makes sense as an internship.

Thanks, Daniel

Quoted 3 lines

julia

I'm not the maintainer but this seems reasonable to me. Yay negative lines.

Jordan

Quoted 41 lines
Quoted 32 lines
Quoted 32 lines
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +1 -5
index 6a68493..b751b76 100644
@@ -1222,10 +1222,7 @@ static int a5xx_crashdumper_init(struct msm_gpu *gpu,
 		SZ_1M, MSM_BO_UNCACHED, gpu->aspace,
 		&dumper->bo, &dumper->iova);
 
-	if (IS_ERR(dumper->ptr))
-		return PTR_ERR(dumper->ptr);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(dumper->ptr);
 }
 
 static void a5xx_crashdumper_free(struct msm_gpu *gpu,
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20181018204815.GA23390%40armorer.
For more options, visit https://groups.google.com/d/optout.

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
reviewer Reviewed-by on v1 1/1
#4 lore raw
In reply to Mamta Shukla
Quoted 5 lines · Mamta Shukla

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR because its better to have inlined function rather than code-opened implementation.

Quoted 23 lines
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +1 -5
index 6a68493..b751b76 100644
@@ -1222,10 +1222,7 @@ static int a5xx_crashdumper_init(struct msm_gpu *gpu,
                SZ_1M, MSM_BO_UNCACHED, gpu->aspace,
                &dumper->bo, &dumper->iova);
 
-       if (IS_ERR(dumper->ptr))
-               return PTR_ERR(dumper->ptr);
-
-       return 0;
+       return PTR_ERR_OR_ZERO(dumper->ptr);
 }
 
 static void a5xx_crashdumper_free(struct msm_gpu *gpu,
--

1.9.1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 8 lines · Sean Paul
Quoted 5 lines · Mamta Shukla

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR because its better to have inlined function rather than code-opened implementation.

Applied to drm-misc-next so Julia can easily spot them all. Thanks for patch&review.
-Daniel

Quoted 28 lines
Quoted 28 lines
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +1 -5
index 6a68493..b751b76 100644
@@ -1222,10 +1222,7 @@ static int a5xx_crashdumper_init(struct msm_gpu *gpu,
                SZ_1M, MSM_BO_UNCACHED, gpu->aspace,
                &dumper->bo, &dumper->iova);
 
-       if (IS_ERR(dumper->ptr))
-               return PTR_ERR(dumper->ptr);
-
-       return 0;
+       return PTR_ERR_OR_ZERO(dumper->ptr);
 }
 
 static void a5xx_crashdumper_free(struct msm_gpu *gpu,
--

1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch