From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161137AbbBEAUV (ORCPT ); Wed, 4 Feb 2015 19:20:21 -0500 Received: from mail-pd0-f180.google.com ([209.85.192.180]:39673 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755666AbbBEAUU (ORCPT ); Wed, 4 Feb 2015 19:20:20 -0500 Date: Thu, 5 Feb 2015 09:20:19 +0900 From: Sergey Senozhatsky To: Andrew Morton Cc: Sergey Senozhatsky , linux-kernel@vger.kernel.org, jmarchan@redhat.com, minchan@kernel.org, ngupta@vflare.org, opensource.ganesh@gmail.com, sergey.senozhatsky@gmail.com, mm-commits@vger.kernel.org Subject: Re: + zram-rework-reset-and-destroy-path-fix.patch added to -mm tree Message-ID: <20150205002019.GA1681@swordfish> References: <54d155bf.k9GCVwDVqT17beYC%akpm@linux-foundation.org> <20150204010720.GC527@swordfish> <20150204142959.de8ddfef8374132b27a5d0c2@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150204142959.de8ddfef8374132b27a5d0c2@linux-foundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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