Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c727040b authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Jens Axboe
Browse files

NVMe: Fix error handling of class_create("nvme")



class_create() returns ERR_PTR on failure,
so IS_ERR() should be used instead of check for NULL.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: default avatarKeith Busch <keith.busch@intel.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent de9ad6d4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3163,8 +3163,10 @@ static int __init nvme_init(void)
		nvme_char_major = result;

	nvme_class = class_create(THIS_MODULE, "nvme");
	if (!nvme_class)
	if (IS_ERR(nvme_class)) {
		result = PTR_ERR(nvme_class);
		goto unregister_chrdev;
	}

	result = pci_register_driver(&nvme_driver);
	if (result)