* [PATCH -next] rapidio/rio_cm: fix return value check in riocm_init()
@ 2016-07-22 13:55 Wei Yongjun
0 siblings, 0 replies; only message in thread
From: Wei Yongjun @ 2016-07-22 13:55 UTC (permalink / raw)
To: Matt Porter, Alexandre Bounine; +Cc: Wei Yongjun, linux-kernel
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().
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
---
drivers/rapidio/rio_cm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c
index 0683e5e..cecc15a 100644
--- a/drivers/rapidio/rio_cm.c
+++ b/drivers/rapidio/rio_cm.c
@@ -2288,9 +2288,9 @@ static int __init riocm_init(void)
/* Create device class needed by udev */
dev_class = class_create(THIS_MODULE, DRV_NAME);
- if (!dev_class) {
+ if (IS_ERR(dev_class)) {
riocm_error("Cannot create " DRV_NAME " class");
- return -EINVAL;
+ return PTR_ERR(dev_class);
}
ret = alloc_chrdev_region(&dev_number, 0, 1, DRV_NAME);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-07-22 13:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-22 13:55 [PATCH -next] rapidio/rio_cm: fix return value check in riocm_init() Wei Yongjun
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®