Received: by 10.192.165.156 with SMTP id m28csp208519imm; Sun, 15 Apr 2018 21:13:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+XcJefM4+eH/uYc05GJEjPhM5HkclUICQrQigm9FeCSnxOgQ88k5SBYhhOqcR28mgtad/z X-Received: by 10.101.93.82 with SMTP id e18mr11884062pgt.123.1523852023077; Sun, 15 Apr 2018 21:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523852023; cv=none; d=google.com; s=arc-20160816; b=Klml+/a6iesqKfjsQSJOCBd0XcLX+bhYl4m6uS/RV8CCHmheCH1J2LTdRq1cxih0i6 Dh/ds3IEIjOr9zS/2kOX6XqUY8B1XVZEl+C4+f2+FpFQ2VttMfbqRJy2nJ8+6OctWp3T WNDO0dKFkj7aS4nslw9Ph7q6Q2M0DbBTsKUqIvmrN7mCpWyzPKjqjaKOnJyMLdhktufv csj3U2s7AJYxz2K21p+KZcHKNEP4OYfXrlHOSc9lYXYzV1qSPJF7mEIFsOlOWYVjxWv8 DKT0rGsOBGWRlno+cZXgSfLuw+OgocuEy3HiMG6Gpvp0YsBYYuOS8xxc9gM7aBSYMxCE 6dVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=qMkte2UpSpIXAgklyxcNzr+4K48LAdQ+AENu4MfJ8FE=; b=xbewV4V1DB2HjA4tW1iKy2rG9W+FleSGPGr/E8q8OOifVtvJ/AZjesbZu+jb/pQgFp /NmYq0Kc0tVm4N8xjUy1/ptmnBaSgIaj8Wd6UhFpgfXPhzor/MoIPLWeb1aysUU8T1AU 97UFYK8NbEHHu37yF6ui6mgpscC1ML7IzgRLXLm/1WbLCo3PJA5Y+b63zislt9Luh1R0 LIwipoYKF27tLoI3k5B1vzgtoifGjchPE3hJZrscxhJuRq0xZsqXGRvhnJiw+MKgwX2d Qxqcx8Md9erxU/qPMGd0WeeyzMqBXBoJQ898xHvp+VK5et1ORabz8hXDmXh+wzaV69pb 75Nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s22-v6si1356170plp.216.2018.04.15.21.13.29; Sun, 15 Apr 2018 21:13:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753359AbeDPEMD (ORCPT + 99 others); Mon, 16 Apr 2018 00:12:03 -0400 Received: from smtp3.ccs.ornl.gov ([160.91.203.39]:36400 "EHLO smtp3.ccs.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753031AbeDPEK0 (ORCPT ); Mon, 16 Apr 2018 00:10:26 -0400 Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id C33C0358; Mon, 16 Apr 2018 00:10:11 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id C058B1F3; Mon, 16 Apr 2018 00:10:11 -0400 (EDT) From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin , NeilBrown Cc: Linux Kernel Mailing List , Lustre Development List , Dmitry Eremin , James Simmons Subject: [PATCH 18/25] staging: lustre: libcfs: clear up failure patch in cfs_cpt_*_print Date: Mon, 16 Apr 2018 00:10:00 -0400 Message-Id: <1523851807-16573-19-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523851807-16573-1-git-send-email-jsimmons@infradead.org> References: <1523851807-16573-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Eremin Currently both cfs_cpt_table_print() and cfs_cpt_distance_print() handle the error path in a confusing way. Simplify it so it just returns E2BIG on failure instead of testing rc value before exiting. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8703 Reviewed-on: https://review.whamcloud.com/23222 Reviewed-by: Amir Shehata Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c index 435ee8e..c4f53ab 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c @@ -155,7 +155,7 @@ struct cfs_cpt_table *cfs_cpt_table_alloc(int ncpt) int cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len) { char *tmp = buf; - int rc = -EFBIG; + int rc; int i; int j; @@ -183,19 +183,17 @@ int cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len) len--; } - rc = 0; -err: - if (rc < 0) - return rc; - return tmp - buf; + +err: + return -E2BIG; } EXPORT_SYMBOL(cfs_cpt_table_print); int cfs_cpt_distance_print(struct cfs_cpt_table *cptab, char *buf, int len) { char *tmp = buf; - int rc = -EFBIG; + int rc; int i; int j; @@ -223,12 +221,11 @@ int cfs_cpt_distance_print(struct cfs_cpt_table *cptab, char *buf, int len) tmp++; len--; } - rc = 0; -err: - if (rc < 0) - return rc; return tmp - buf; + +err: + return -E2BIG; } EXPORT_SYMBOL(cfs_cpt_distance_print); -- 1.8.3.1