nvmet: fix return value check in nvmet_subsys_alloc()

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

Signed-off-by: Wei Yongjun <[email protected]>
Reviewed-by: Jay Freyensee <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
Wei Yongjun 2016-07-06 12:02:09 +00:00 • committed by Jens Axboe
commit 69555af2ce

View file

@ -895,7 +895,7 @@ struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,
subsys->type = type;
subsys->subsysnqn = kstrndup(subsysnqn, NVMF_NQN_SIZE,
GFP_KERNEL);
if (IS_ERR(subsys->subsysnqn)) {
if (!subsys->subsysnqn) {
kfree(subsys);
return NULL;
}