Skip to content

Commit 31a5990

Browse files
stonezdmrichardweinberger
authored andcommitted
um: Fix return value in ubd_init()
When kmalloc_array() fails to allocate memory, the ubd_init() should return -ENOMEM instead of -1. So, fix it. Fixes: f88f0bd ("um: UBD Improvements") Signed-off-by: Duoming Zhou <[email protected]> Reviewed-by: Johannes Berg <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent ed30a4a commit 31a5990

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/um/drivers/ubd_kern.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ static int __init ubd_init(void)
10921092

10931093
if (irq_req_buffer == NULL) {
10941094
printk(KERN_ERR "Failed to initialize ubd buffering\n");
1095-
return -1;
1095+
return -ENOMEM;
10961096
}
10971097
io_req_buffer = kmalloc_array(UBD_REQ_BUFFER_SIZE,
10981098
sizeof(struct io_thread_req *),
@@ -1103,7 +1103,7 @@ static int __init ubd_init(void)
11031103

11041104
if (io_req_buffer == NULL) {
11051105
printk(KERN_ERR "Failed to initialize ubd buffering\n");
1106-
return -1;
1106+
return -ENOMEM;
11071107
}
11081108
platform_driver_register(&ubd_driver);
11091109
mutex_lock(&ubd_lock);

0 commit comments

Comments
 (0)