From patchwork Thu May 15 12:26:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seunghun Lee X-Patchwork-Id: 349193 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A5E7A1400D4 for ; Thu, 15 May 2014 22:26:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752399AbaEOM0i (ORCPT ); Thu, 15 May 2014 08:26:38 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:36509 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753941AbaEOM0e (ORCPT ); Thu, 15 May 2014 08:26:34 -0400 Received: by mail-pa0-f50.google.com with SMTP id fb1so1019059pad.37 for ; Thu, 15 May 2014 05:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gVSWQ0q64NS2imRmGkjSFpL2TJ5uyy0MIn+43iAlu2E=; b=E1onvfIXUchdOUEI9TDT6UZqAC+591Sy8bpYatIkv3OhqPqMWBh1Uk3A6nsC41vym5 6kgcuBbezhC/feYe1RPohZYE1vbE6waT0EiUxme4D/0AATM+EK7+1PSDtJVe2PgfHail P6qsxlFgdRlevDWMGqqNZfSCM0TcS5dSEdRaxWRV6TayOrIUnR8LZxU+ZIk66ksyXOlY CFB5C19TyrxYOBTLSbYuLpXG/0Vae64ErHl0JYhckr1IIzTcPjez4FsQnEEljBh/p77X HXvFdYRjG1IQLLFO+SzqhMGJEOWwrcg3Dj8lk7ZyFXnfLvAlyx2xjRXC4NcAtpTxuV4m EHhg== X-Received: by 10.66.66.225 with SMTP id i1mr12215113pat.0.1400156794251; Thu, 15 May 2014 05:26:34 -0700 (PDT) Received: from localhost.localdomain ([61.77.65.80]) by mx.google.com with ESMTPSA id wq10sm20747870pac.24.2014.05.15.05.26.32 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 May 2014 05:26:33 -0700 (PDT) From: Seunghun Lee To: jack@suse.cz Cc: lczerner@redhat.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, Seunghun Lee Subject: [PATCH 2/2] ext2: fix error handling in ext2_fill_super() Date: Thu, 15 May 2014 21:26:16 +0900 Message-Id: <1400156776-3412-2-git-send-email-waydi1@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400156776-3412-1-git-send-email-waydi1@gmail.com> References: <1400156776-3412-1-git-send-email-waydi1@gmail.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org ext2_fill_super is using err variable, but it is not applied to return value. This patch fixes it. Signed-off-by: Seunghun Lee --- fs/ext2/super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index e3fc51e..7e36536 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -770,14 +770,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) unsigned long logic_sb_block; unsigned long offset = 0; unsigned long def_mount_opts; - int ret = -EINVAL; + int ret = -ENOMEM; int blocksize = BLOCK_SIZE; int db_count; int i, j; __le32 features; - int err; + int err = 0; - err = -ENOMEM; sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) goto failed; @@ -793,6 +792,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) spin_lock_init(&sbi->s_lock); + /* -EINVAL is default */ + ret = -EINVAL; + /* * See what the current blocksize for the device is, and * use that as the blocksize. Otherwise (or if the blocksize @@ -1140,7 +1142,7 @@ failed_sbi: kfree(sbi->s_blockgroup_lock); kfree(sbi); failed: - return ret; + return err ? err : ret; } static void ext2_clear_super_error(struct super_block *sb)