dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amd: cleanup coding style a bit
@ 2021-03-31 13:12 Bernard Zhao
  2021-04-01 21:11 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Bernard Zhao @ 2021-03-31 13:12 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie, Daniel Vetter,
	Guchun Chen, Hawking Zhang, Dennis Li, John Clements,
	Arnd Bergmann, Stanley.Yang, amd-gfx, dri-devel, linux-kernel
  Cc: opensource.kernel, Bernard Zhao

Fix patch check warning:
WARNING: suspect code indent for conditional statements (8, 17)
+       if (obj && obj->use < 0) {
+                DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", obj->head.name);

WARNING: braces {} are not necessary for single statement blocks
+       if (obj && obj->use < 0) {
+                DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", obj->head.name);
+       }

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 1fb2a91ad30a..43d17b72c265 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -449,11 +449,10 @@ static ssize_t amdgpu_ras_sysfs_read(struct device *dev,
 
 static inline void put_obj(struct ras_manager *obj)
 {
-	if (obj && --obj->use == 0)
+	if (obj && (--obj->use == 0))
 		list_del(&obj->node);
-	if (obj && obj->use < 0) {
-		 DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", obj->head.name);
-	}
+	if (obj && (obj->use < 0))
+		DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", obj->head.name);
 }
 
 /* make one obj and return it. */
-- 
2.31.0

_______________________________________________
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/amd: cleanup coding style a bit
  2021-03-31 13:12 [PATCH] drm/amd: cleanup coding style a bit Bernard Zhao
@ 2021-04-01 21:11 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2021-04-01 21:11 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: opensource.kernel, Arnd Bergmann, Guchun Chen, David Airlie,
	LKML, amd-gfx list, Stanley.Yang, Maling list - DRI developers,
	Alex Deucher, John Clements, Christian König, Dennis Li,
	Hawking Zhang

Applied.  Thanks!

Alex

On Wed, Mar 31, 2021 at 9:36 AM Bernard Zhao <bernard@vivo.com> wrote:
>
> Fix patch check warning:
> WARNING: suspect code indent for conditional statements (8, 17)
> +       if (obj && obj->use < 0) {
> +                DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", obj->head.name);
>
> WARNING: braces {} are not necessary for single statement blocks
> +       if (obj && obj->use < 0) {
> +                DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", obj->head.name);
> +       }
>
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index 1fb2a91ad30a..43d17b72c265 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -449,11 +449,10 @@ static ssize_t amdgpu_ras_sysfs_read(struct device *dev,
>
>  static inline void put_obj(struct ras_manager *obj)
>  {
> -       if (obj && --obj->use == 0)
> +       if (obj && (--obj->use == 0))
>                 list_del(&obj->node);
> -       if (obj && obj->use < 0) {
> -                DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", obj->head.name);
> -       }
> +       if (obj && (obj->use < 0))
> +               DRM_ERROR("RAS ERROR: Unbalance obj(%s) use\n", obj->head.name);
>  }
>
>  /* make one obj and return it. */
> --
> 2.31.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
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:[~2021-04-01 21:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31 13:12 [PATCH] drm/amd: cleanup coding style a bit Bernard Zhao
2021-04-01 21:11 ` Alex Deucher

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).