[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANEJEGsgk3qy-Kz-tAuAGccqVcvNRNqamK7_UeKgHd7nx6LGOQ@mail.gmail.com>
Date: Mon, 9 Nov 2015 15:44:26 -0800
From: Grant Grundler <grundler@...omium.org>
To: Vishnu Pratap Singh <vishnu.ps@...sung.com>
Cc: Jens Axboe <axboe@...nel.dk>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>,
Jeff Moyer <jmoyer@...hat.com>, minchan@...nel.org,
ngupta@...are.org, sergey.senozhatsky.work@...il.com,
David Miller <davem@...emloft.net>, neilb@...e.com,
Ulf Hansson <ulf.hansson@...aro.org>, tiwai@...e.de,
Hannes Reinecke <hare@...e.de>,
Ming Lei <ming.lei@...onical.com>, jarod@...hat.com,
viro@...iv.linux.org.uk, Tejun Heo <tj@...nel.org>,
adrian.hunter@...el.com, Jon Hunter <jonathanh@...dia.com>,
Grant Grundler <grundler@...omium.org>,
Linux IDE mailing list <linux-ide@...r.kernel.org>,
linux-raid@...r.kernel.org,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
CPGS <cpgs@...sung.com>, vishu13285@...il.com,
pintu.k@...sung.com, rohit.kr@...sung.com
Subject: Re: [PATCH 3/8] block/floppy.c: handle blk_register_region() return value
On Fri, Nov 6, 2015 at 4:22 AM, Vishnu Pratap Singh
<vishnu.ps@...sung.com> wrote:
> 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@...sung.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_region;
Please drop this hunk.
> }
>
> /* 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:
Nit: out_unreg_region should continue to be a label for the
unregister_region call.
My preference would be to add a new label here so something like
"goto out_driver_unregister" works.
I normally would ignore this sort of thing but this patch needs to be
reposted as V2 anyway.
cheers,
grant
> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists