um: Fix return value in ubd_init()
authorDuoming Zhou <duoming@zju.edu.cn>
Wed, 6 Mar 2024 09:12:59 +0000 (17:12 +0800)
committerRichard Weinberger <richard@nod.at>
Mon, 22 Apr 2024 19:38:23 +0000 (21:38 +0200)
When kmalloc_array() fails to allocate memory, the ubd_init()
should return -ENOMEM instead of -1. So, fix it.

Fixes: f88f0bdfc32f ("um: UBD Improvements")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Richard Weinberger <richard@nod.at>
arch/um/drivers/ubd_kern.c

index 63fc062add708cf8e09f5f23185478ef8b85a88a..ef805eaa9e013d14785423133e547375786eab93 100644 (file)
@@ -1092,7 +1092,7 @@ static int __init ubd_init(void)
 
        if (irq_req_buffer == NULL) {
                printk(KERN_ERR "Failed to initialize ubd buffering\n");
-               return -1;
+               return -ENOMEM;
        }
        io_req_buffer = kmalloc_array(UBD_REQ_BUFFER_SIZE,
                                      sizeof(struct io_thread_req *),
@@ -1103,7 +1103,7 @@ static int __init ubd_init(void)
 
        if (io_req_buffer == NULL) {
                printk(KERN_ERR "Failed to initialize ubd buffering\n");
-               return -1;
+               return -ENOMEM;
        }
        platform_driver_register(&ubd_driver);
        mutex_lock(&ubd_lock);