From c727040bdaa28cd7aa9dbc086eee7b236e0fb270 Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov Date: Sat, 7 Mar 2015 01:43:41 +0300 Subject: 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: Alexey Khoroshilov Acked-by: Keith Busch Signed-off-by: Jens Axboe --- drivers/block/nvme-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/block') diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index ef43278..9052553 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -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) -- cgit v1.1