Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1265316

[PATCH 3/8] block/floppy.c: handle blk_register_region() return value

From Vishnu Pratap Singh <vishnu.ps@samsung.com>
Newsgroups linux.kernel
Subject [PATCH 3/8] block/floppy.c: handle blk_register_region() return value
Date 2015-11-09 04:20 +0100
Message-ID <qsL9T-Lx-7@gated-at.bofh.it> (permalink)
References <qrOjx-4rO-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This patch handles blk_register_region() return value.
Earlier blk_register_region() function doesn't handle error
cases, now it is added, so the callers of this function
should also handle it.

Verfied on X86 based ubuntu machine.
This patch depends on [PATCH 1/8] block/genhd.c: Add error handling

Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>
---
 drivers/block/floppy.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 331363e..50802a6 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4219,8 +4219,10 @@ static int __init do_floppy_init(void)
 	if (err)
 		goto out_unreg_blkdev;
 
-	blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE,
+	err = blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE,
 			    floppy_find, NULL, NULL);
+	if (err)
+		goto out_unreg_region;
 
 	for (i = 0; i < 256; i++)
 		if (ITYPE(i))
@@ -4250,7 +4252,7 @@ static int __init do_floppy_init(void)
 	if (fdc_state[0].address == -1) {
 		cancel_delayed_work(&fd_timeout);
 		err = -ENODEV;
-		goto out_unreg_region;
+		goto out_fdc_err;
 	}
 #if N_FDC > 1
 	fdc_state[1].address = FDC2;
@@ -4261,7 +4263,7 @@ static int __init do_floppy_init(void)
 	if (err) {
 		cancel_delayed_work(&fd_timeout);
 		err = -EBUSY;
-		goto out_unreg_region;
+		goto out_fdc_err;
 	}
 
 	/* initialise drive state */
@@ -4357,8 +4359,9 @@ out_remove_drives:
 out_release_dma:
 	if (atomic_read(&usage_count))
 		floppy_release_irq_and_dma();
-out_unreg_region:
+out_fdc_err:
 	blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
+out_unreg_region:
 	platform_driver_unregister(&floppy_driver);
 out_unreg_blkdev:
 	unregister_blkdev(FLOPPY_MAJOR, "fd");
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/8] block/genhd.c: Add error handling Vishnu Pratap Singh <vishnu.ps@samsung.com> - 2015-11-06 13:30 +0100
  [PATCH 3/8] block/floppy.c: handle blk_register_region() return value Vishnu Pratap Singh <vishnu.ps@samsung.com> - 2015-11-06 13:30 +0100
    [PATCH 3/8] block/floppy.c: handle blk_register_region() return value Vishnu Pratap Singh <vishnu.ps@samsung.com> - 2015-11-09 04:20 +0100
    Re: [PATCH 3/8] block/floppy.c: handle blk_register_region() return value Grant Grundler <grundler@chromium.org> - 2015-11-10 00:50 +0100
    [PATCH v2] block/floppy.c: handle blk_register_region() return value Vishnu Pratap Singh <vishnu.ps@samsung.com> - 2015-11-10 04:30 +0100
  [PATCH 6/8] md/md.c: handle blk_register_region() return value Vishnu Pratap Singh <vishnu.ps@samsung.com> - 2015-11-06 13:40 +0100
  [PATCH 4/8] block/loop.c: handle add_disk() & blk_register_region()  return value Vishnu Pratap Singh <vishnu.ps@samsung.com> - 2015-11-06 13:40 +0100
  [PATCH 5/8] zram: handle add_disk() & blk_register_region() return  value Vishnu Pratap Singh <vishnu.ps@samsung.com> - 2015-11-06 13:40 +0100
    Re: [PATCH 5/8] zram: handle add_disk() & blk_register_region()  return value Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-11-09 02:10 +0100
  [PATCH 7/8] cdrom/gdrom.c: handle add_disk() return value Vishnu Pratap Singh <vishnu.ps@samsung.com> - 2015-11-06 13:40 +0100
  [PATCH 8/8] ide/ide-probe.c: handle blk_register_region() return value Vishnu Pratap Singh <vishnu.ps@samsung.com> - 2015-11-06 13:50 +0100
  Re: [PATCH 1/8] block/genhd.c: Add error handling Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-10 04:40 +0100
    Re: [PATCH 1/8] block/genhd.c: Add error handling Jens Axboe <axboe@kernel.dk> - 2015-11-10 04:50 +0100
      Re: [PATCH 1/8] block/genhd.c: Add error handling Jeff Moyer <jmoyer@redhat.com> - 2015-11-10 15:20 +0100

csiph-web