All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yongjun <weiyongjun1@huawei.com>
To: kernel-janitors@vger.kernel.org
Subject: [PATCH -next] oradax: Fix return value check in dax_attach()
Date: Sat, 27 Jan 2018 08:10:59 +0000	[thread overview]
Message-ID: <1517040659-37838-1-git-send-email-weiyongjun1@huawei.com> (raw)

In case of error, the function class_create() returns ERR_PTR() and
never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR().

Fixes: dd0273284c74 ("sparc64: Oracle DAX driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/sbus/char/oradax.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/sbus/char/oradax.c b/drivers/sbus/char/oradax.c
index 10452ae..03dc047 100644
--- a/drivers/sbus/char/oradax.c
+++ b/drivers/sbus/char/oradax.c
@@ -336,9 +336,9 @@ static int __init dax_attach(void)
 	}
 
 	cl = class_create(THIS_MODULE, DAX_NAME);
-	if (cl = NULL) {
+	if (IS_ERR(cl)) {
 		dax_err("class_create failed");
-		ret = -ENXIO;
+		ret = PTR_ERR(cl);
 		goto class_error;
 	}


             reply	other threads:[~2018-01-27  8:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-27  8:10 Wei Yongjun [this message]
2018-01-29 19:29 ` [PATCH -next] oradax: Fix return value check in dax_attach() David Miller

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=1517040659-37838-1-git-send-email-weiyongjun1@huawei.com \
    --to=weiyongjun1@huawei.com \
    --cc=kernel-janitors@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 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.