Hello,
sorry for late response

On (02/04/15 14:29), Andrew Morton wrote:
> Seems unnecessarily complicated.  What about
> 
> --- 
> a/drivers/block/zram/zram_drv.c~zram-rework-reset-and-destroy-path-fix-2-fix
> +++ a/drivers/block/zram/zram_drv.c
> @@ -1141,7 +1141,8 @@ static void destroy_devices(unsigned int
>  
>  static int __init zram_init(void)
>  {
> -     int ret = -ENOMEM, dev_id = 0;
> +     int ret;
> +     int dev_id;
>  
>       if (num_devices > max_num_devices) {
>               pr_warn("Invalid value for num_devices: %u\n",
> @@ -1157,20 +1158,23 @@ static int __init zram_init(void)
>  
>       /* Allocate the device array and initialize each one */
>       zram_devices = kzalloc(num_devices * sizeof(struct zram), GFP_KERNEL);
> -     if (!zram_devices)
> -             goto out_error;
> +     if (!zram_devices) {
> +             ret = -ENOMEM;

we need to rollback `zram_major = register_blkdev(0, "zram");'
which is done in destroy_devices().

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

Reply via email to