mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cai Huoqing <caihuoqing@baidu.com>
To: <Felix.Kuehling@amd.com>, <alexander.deucher@amd.com>,
	<christian.koenig@amd.com>, <Xinhui.Pan@amd.com>,
	<airlied@linux.ie>, <daniel@ffwll.ch>
Cc: <amd-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
	Cai Huoqing <caihuoqing@baidu.com>
Subject: [PATCH] drm/amdkfd: move PTR_ERR under IS_ERR() condition
Date: Tue, 20 Jul 2021 14:34:35 +0800	[thread overview]
Message-ID: <20210720063435.373-1-caihuoqing@baidu.com> (raw)

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


             reply	other threads:[~2021-07-20  6:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20  6:34 Cai Huoqing [this message]
2021-07-27 18:16 ` Felix Kuehling

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=20210720063435.373-1-caihuoqing@baidu.com \
    --to=caihuoqing@baidu.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®