staging: axis-fifo: add error handling of class_create()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Fri, 28 Sep 2018 21:25:27 +0000 (00:25 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Oct 2018 22:18:36 +0000 (15:18 -0700)
Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/axis-fifo/axis-fifo.c

index abeee0e..63c8efd 100644 (file)
@@ -1089,6 +1089,8 @@ static int __init axis_fifo_init(void)
        pr_info("axis-fifo driver loaded with parameters read_timeout = %i, write_timeout = %i\n",
                read_timeout, write_timeout);
        axis_fifo_driver_class = class_create(THIS_MODULE, DRIVER_NAME);
+       if (IS_ERR(axis_fifo_driver_class))
+               return PTR_ERR(axis_fifo_driver_class);
        return platform_driver_register(&axis_fifo_driver);
 }