aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2015-03-06 17:43:41 -0500
committerJens Axboe <axboe@fb.com>2015-04-07 21:08:58 -0400
commitc727040bdaa28cd7aa9dbc086eee7b236e0fb270 (patch)
tree87e61b4cf7225eb8ac235e2f9007c682e76e3887 /drivers/block
parentde9ad6d4edb63e0ba5d5aae365fb3565064fc00d (diff)
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 <khoroshilov@ispras.ru> Acked-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nvme-core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index ef432786213b..9052553eda65 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -3163,8 +3163,10 @@ static int __init nvme_init(void)
3163 nvme_char_major = result; 3163 nvme_char_major = result;
3164 3164
3165 nvme_class = class_create(THIS_MODULE, "nvme"); 3165 nvme_class = class_create(THIS_MODULE, "nvme");
3166 if (!nvme_class) 3166 if (IS_ERR(nvme_class)) {
3167 result = PTR_ERR(nvme_class);
3167 goto unregister_chrdev; 3168 goto unregister_chrdev;
3169 }
3168 3170
3169 result = pci_register_driver(&nvme_driver); 3171 result = pci_register_driver(&nvme_driver);
3170 if (result) 3172 if (result)