All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: move PTR_ERR under IS_ERR() condition
@ 2021-07-20  6:34 ` Cai Huoqing
  0 siblings, 0 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-07-20  6:34 UTC (permalink / raw)
  To: Felix.Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: amd-gfx, dri-devel, linux-kernel, Cai Huoqing

no need to get error code when IS_ERR is false

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index e48acdd03c1a..710659b3c1f0 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -72,16 +72,18 @@ int kfd_chardev_init(void)
                goto err_register_chrdev;

        kfd_class = class_create(THIS_MODULE, kfd_dev_name);
-       err = PTR_ERR(kfd_class);
-       if (IS_ERR(kfd_class))
+       if (IS_ERR(kfd_class)) {
+               err = PTR_ERR(kfd_class);
                goto err_class_create;
+       }

        kfd_device = device_create(kfd_class, NULL,
                                        MKDEV(kfd_char_dev_major, 0),
                                        NULL, kfd_dev_name);
-       err = PTR_ERR(kfd_device);
-       if (IS_ERR(kfd_device))
+       if (IS_ERR(kfd_device)) {
+               err = PTR_ERR(kfd_device);
                goto err_device_create;
+       }

        return 0;

--
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] drm/amdkfd: move PTR_ERR under IS_ERR() condition
@ 2021-07-20  6:34 ` Cai Huoqing
  0 siblings, 0 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-07-20  6:34 UTC (permalink / raw)
  To: Felix.Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: Cai Huoqing, dri-devel, amd-gfx, linux-kernel

no need to get error code when IS_ERR is false

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index e48acdd03c1a..710659b3c1f0 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -72,16 +72,18 @@ int kfd_chardev_init(void)
                goto err_register_chrdev;

        kfd_class = class_create(THIS_MODULE, kfd_dev_name);
-       err = PTR_ERR(kfd_class);
-       if (IS_ERR(kfd_class))
+       if (IS_ERR(kfd_class)) {
+               err = PTR_ERR(kfd_class);
                goto err_class_create;
+       }

        kfd_device = device_create(kfd_class, NULL,
                                        MKDEV(kfd_char_dev_major, 0),
                                        NULL, kfd_dev_name);
-       err = PTR_ERR(kfd_device);
-       if (IS_ERR(kfd_device))
+       if (IS_ERR(kfd_device)) {
+               err = PTR_ERR(kfd_device);
                goto err_device_create;
+       }

        return 0;

--
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] drm/amdkfd: move PTR_ERR under IS_ERR() condition
@ 2021-07-20  6:34 ` Cai Huoqing
  0 siblings, 0 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-07-20  6:34 UTC (permalink / raw)
  To: Felix.Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: Cai Huoqing, dri-devel, amd-gfx, linux-kernel

no need to get error code when IS_ERR is false

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index e48acdd03c1a..710659b3c1f0 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -72,16 +72,18 @@ int kfd_chardev_init(void)
                goto err_register_chrdev;

        kfd_class = class_create(THIS_MODULE, kfd_dev_name);
-       err = PTR_ERR(kfd_class);
-       if (IS_ERR(kfd_class))
+       if (IS_ERR(kfd_class)) {
+               err = PTR_ERR(kfd_class);
                goto err_class_create;
+       }

        kfd_device = device_create(kfd_class, NULL,
                                        MKDEV(kfd_char_dev_major, 0),
                                        NULL, kfd_dev_name);
-       err = PTR_ERR(kfd_device);
-       if (IS_ERR(kfd_device))
+       if (IS_ERR(kfd_device)) {
+               err = PTR_ERR(kfd_device);
                goto err_device_create;
+       }

        return 0;

--
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdkfd: move PTR_ERR under IS_ERR() condition
  2021-07-20  6:34 ` Cai Huoqing
  (?)
@ 2021-07-27 18:16   ` Felix Kuehling
  -1 siblings, 0 replies; 6+ messages in thread
From: Felix Kuehling @ 2021-07-27 18:16 UTC (permalink / raw)
  To: Cai Huoqing, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: amd-gfx, dri-devel, linux-kernel

Hi Huoqing,

Your patch is technically correct. However, I don't think it fixes any
actual bug, and it changes a code path that has no performance
implications. Therefore I would just leave it as it is.

Regards,
  Felix


Am 2021-07-20 um 2:34 a.m. schrieb Cai Huoqing:
> no need to get error code when IS_ERR is false
>
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index e48acdd03c1a..710659b3c1f0 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -72,16 +72,18 @@ int kfd_chardev_init(void)
>                 goto err_register_chrdev;
>
>         kfd_class = class_create(THIS_MODULE, kfd_dev_name);
> -       err = PTR_ERR(kfd_class);
> -       if (IS_ERR(kfd_class))
> +       if (IS_ERR(kfd_class)) {
> +               err = PTR_ERR(kfd_class);
>                 goto err_class_create;
> +       }
>
>         kfd_device = device_create(kfd_class, NULL,
>                                         MKDEV(kfd_char_dev_major, 0),
>                                         NULL, kfd_dev_name);
> -       err = PTR_ERR(kfd_device);
> -       if (IS_ERR(kfd_device))
> +       if (IS_ERR(kfd_device)) {
> +               err = PTR_ERR(kfd_device);
>                 goto err_device_create;
> +       }
>
>         return 0;
>
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdkfd: move PTR_ERR under IS_ERR() condition
@ 2021-07-27 18:16   ` Felix Kuehling
  0 siblings, 0 replies; 6+ messages in thread
From: Felix Kuehling @ 2021-07-27 18:16 UTC (permalink / raw)
  To: Cai Huoqing, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: dri-devel, amd-gfx, linux-kernel

Hi Huoqing,

Your patch is technically correct. However, I don't think it fixes any
actual bug, and it changes a code path that has no performance
implications. Therefore I would just leave it as it is.

Regards,
  Felix


Am 2021-07-20 um 2:34 a.m. schrieb Cai Huoqing:
> no need to get error code when IS_ERR is false
>
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index e48acdd03c1a..710659b3c1f0 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -72,16 +72,18 @@ int kfd_chardev_init(void)
>                 goto err_register_chrdev;
>
>         kfd_class = class_create(THIS_MODULE, kfd_dev_name);
> -       err = PTR_ERR(kfd_class);
> -       if (IS_ERR(kfd_class))
> +       if (IS_ERR(kfd_class)) {
> +               err = PTR_ERR(kfd_class);
>                 goto err_class_create;
> +       }
>
>         kfd_device = device_create(kfd_class, NULL,
>                                         MKDEV(kfd_char_dev_major, 0),
>                                         NULL, kfd_dev_name);
> -       err = PTR_ERR(kfd_device);
> -       if (IS_ERR(kfd_device))
> +       if (IS_ERR(kfd_device)) {
> +               err = PTR_ERR(kfd_device);
>                 goto err_device_create;
> +       }
>
>         return 0;
>
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdkfd: move PTR_ERR under IS_ERR() condition
@ 2021-07-27 18:16   ` Felix Kuehling
  0 siblings, 0 replies; 6+ messages in thread
From: Felix Kuehling @ 2021-07-27 18:16 UTC (permalink / raw)
  To: Cai Huoqing, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: dri-devel, amd-gfx, linux-kernel

Hi Huoqing,

Your patch is technically correct. However, I don't think it fixes any
actual bug, and it changes a code path that has no performance
implications. Therefore I would just leave it as it is.

Regards,
  Felix


Am 2021-07-20 um 2:34 a.m. schrieb Cai Huoqing:
> no need to get error code when IS_ERR is false
>
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index e48acdd03c1a..710659b3c1f0 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -72,16 +72,18 @@ int kfd_chardev_init(void)
>                 goto err_register_chrdev;
>
>         kfd_class = class_create(THIS_MODULE, kfd_dev_name);
> -       err = PTR_ERR(kfd_class);
> -       if (IS_ERR(kfd_class))
> +       if (IS_ERR(kfd_class)) {
> +               err = PTR_ERR(kfd_class);
>                 goto err_class_create;
> +       }
>
>         kfd_device = device_create(kfd_class, NULL,
>                                         MKDEV(kfd_char_dev_major, 0),
>                                         NULL, kfd_dev_name);
> -       err = PTR_ERR(kfd_device);
> -       if (IS_ERR(kfd_device))
> +       if (IS_ERR(kfd_device)) {
> +               err = PTR_ERR(kfd_device);
>                 goto err_device_create;
> +       }
>
>         return 0;
>
> --
> 2.25.1
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-27 18:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20  6:34 [PATCH] drm/amdkfd: move PTR_ERR under IS_ERR() condition Cai Huoqing
2021-07-20  6:34 ` Cai Huoqing
2021-07-20  6:34 ` Cai Huoqing
2021-07-27 18:16 ` Felix Kuehling
2021-07-27 18:16   ` Felix Kuehling
2021-07-27 18:16   ` Felix Kuehling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.