dio: return -ENOMEM when kzalloc() fails
authorSalah Triki <salah.triki@gmail.com>
Fri, 2 Jul 2021 13:31:14 +0000 (14:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Jul 2021 13:53:24 +0000 (15:53 +0200)
Return -ENOMEM when kzalloc() fails in order to inform the caller of the
failure.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
Link: https://lore.kernel.org/r/20210702133114.GA314157@pc
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/dio/dio.c

index 193b40e..4c06c93 100644 (file)
@@ -219,7 +219,7 @@ static int __init dio_init(void)
                 /* Found a board, allocate it an entry in the list */
                dev = kzalloc(sizeof(struct dio_dev), GFP_KERNEL);
                if (!dev)
-                       return 0;
+                       return -ENOMEM;
 
                dev->bus = &dio_bus;
                dev->dev.parent = &dio_bus.dev;