Skip to content

Commit

Permalink
um: Fix return value in ubd_init()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
stonezdm authored and richardweinberger committed Apr 22, 2024
1 parent ed30a4a commit 31a5990
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/um/drivers/ubd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *),
Expand All @@ -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);
Expand Down

0 comments on commit 31a5990

Please sign in to comment.