[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150205003424.GA462@swordfish>
Date: Thu, 5 Feb 2015 09:36:46 +0900
From: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
linux-kernel@...r.kernel.org, jmarchan@...hat.com,
minchan@...nel.org, ngupta@...are.org, opensource.ganesh@...il.com,
sergey.senozhatsky@...il.com, mm-commits@...r.kernel.org
Subject: Re: + zram-rework-reset-and-destroy-path-fix.patch added to -mm tree
On (02/04/15 14:29), Andrew Morton wrote:
> which yields
>
/* not sure if my previous email has been delived, seems there are some
connectivity problems on my side */
we need to unregister_blkdev(), 'out' label does not do it.
how about the following one (looks simple):
> static int __init zram_init(void)
> {
> int ret;
> int dev_id;
>
> if (num_devices > max_num_devices) {
> pr_warn("Invalid value for num_devices: %u\n",
> num_devices);
> return -EINVAL;
> }
>
> zram_major = register_blkdev(0, "zram");
> if (zram_major <= 0) {
> pr_warn("Unable to get major number\n");
> return -EBUSY;
> }
>
> /* Allocate the device array and initialize each one */
> zram_devices = kzalloc(num_devices * sizeof(struct zram), GFP_KERNEL);
> if (!zram_devices) {
- ret = -ENOMEM;
- goto out_error;
+ unregister_blkdev(zram_major, "zram");
+ return -ENOMEM;
> }
>
> for (dev_id = 0; dev_id < num_devices; dev_id++) {
> ret = create_device(&zram_devices[dev_id], dev_id);
> if (ret)
> goto out_devices;
> }
>
> pr_info("Created %u device(s)\n", num_devices);
> return 0;
>
> out_devices:
> destroy_devices(dev_id);
- out:
> return ret;
> }
--
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