Thread (15 messages) 15 messages, 1 author, 2021-09-04
STALE1768d
Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

[PATCH 05/14] floppy: add error handling support for add_disk()

From: Luis Chamberlain <mcgrof@kernel.org>
Date: 2021-09-04 01:35:48
Also in: lkml
Subsystem: block layer, floppy driver, the rest · Maintainers: Jens Axboe, Denis Efremov, Linus Torvalds

We never checked for errors on add_disk() as this function
returned void. Now that this is fixed, use the shiny new
error handling.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/block/floppy.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 3592a6277d0b..0434f28742e7 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4696,8 +4696,10 @@ static int __init do_floppy_init(void)
 
 		registered[drive] = true;
 
-		device_add_disk(&floppy_device[drive].dev, disks[drive][0],
-				NULL);
+		err = device_add_disk(&floppy_device[drive].dev,
+				      disks[drive][0], NULL);
+		if (err)
+			goto out_remove_drives;
 	}
 
 	return 0;
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help