From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Tiezhu Yang" Subject: [PATCH] f2fs: remove unnecessary goto statement Date: Tue, 28 Jun 2016 07:27:59 +0800 (CST) Message-ID: <76d0a86c.637.1559430e066.Coremail.kernelpatch@126.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1bHfwr-0003IY-QH for linux-f2fs-devel@lists.sourceforge.net; Mon, 27 Jun 2016 23:28:14 +0000 Received: from m15-43.126.com ([220.181.15.43]) by sog-mx-4.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1bHfwp-00048U-VF for linux-f2fs-devel@lists.sourceforge.net; Mon, 27 Jun 2016 23:28:13 +0000 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: jaegeuk@kernel.org Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net When base_addr is NULL, there is no need to call kzfree, it should return -ENOMEM directly. Additionally, it is better to initialize variable 'error' with 0. Signed-off-by: Tiezhu Yang --- fs/f2fs/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 5564e0f..e530254 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -447,7 +447,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, int found, newsize; size_t len; __u32 new_hsize; - int error = -ENOMEM; + int error = 0; if (name == NULL) return -EINVAL; @@ -465,7 +465,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, base_addr = read_all_xattrs(inode, ipage); if (!base_addr) - goto exit; + return -ENOMEM; /* find entry with wanted name. */ here = __find_xattr(base_addr, index, len, name); -- 1.8.3.1 ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752109AbcF0X7U (ORCPT ); Mon, 27 Jun 2016 19:59:20 -0400 Received: from m15-43.126.com ([220.181.15.43]:30845 "EHLO m15-43.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752002AbcF0X7S (ORCPT ); Mon, 27 Jun 2016 19:59:18 -0400 X-Greylist: delayed 1862 seconds by postgrey-1.27 at vger.kernel.org; Mon, 27 Jun 2016 19:59:18 EDT X-Originating-IP: [36.111.128.106] Date: Tue, 28 Jun 2016 07:27:59 +0800 (CST) From: "Tiezhu Yang" To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] f2fs: remove unnecessary goto statement X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20160420(83524.8626) Copyright (c) 2002-2016 www.mailtech.cn 126com Content-Type: text/plain; charset=GBK MIME-Version: 1.0 Message-ID: <76d0a86c.637.1559430e066.Coremail.kernelpatch@126.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: K8qowADHzpaAtnFXsBwjAA--.32925W X-CM-SenderInfo: xnhu0vxosd3ubk6rjloofrz/1tbimRGV9VYFL0FtcQABsI X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u5RNxPh8007856 When base_addr is NULL, there is no need to call kzfree, it should return -ENOMEM directly. Additionally, it is better to initialize variable 'error' with 0. Signed-off-by: Tiezhu Yang --- fs/f2fs/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 5564e0f..e530254 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -447,7 +447,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, int found, newsize; size_t len; __u32 new_hsize; - int error = -ENOMEM; + int error = 0; if (name == NULL) return -EINVAL; @@ -465,7 +465,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, base_addr = read_all_xattrs(inode, ipage); if (!base_addr) - goto exit; + return -ENOMEM; /* find entry with wanted name. */ here = __find_xattr(base_addr, index, len, name); -- 1.8.3.1