From patchwork Fri Dec 27 01:45:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangweidong X-Patchwork-Id: 305328 X-Patchwork-Delegate: davem@davemloft.net 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 585DD2C0091 for ; Fri, 27 Dec 2013 12:45:47 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754003Ab3L0Bpm (ORCPT ); Thu, 26 Dec 2013 20:45:42 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:57602 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753920Ab3L0Bpl (ORCPT ); Thu, 26 Dec 2013 20:45:41 -0500 Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BNS61908; Fri, 27 Dec 2013 09:45:27 +0800 (CST) Received: from SZXEML410-HUB.china.huawei.com (10.82.67.137) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.3.158.1; Fri, 27 Dec 2013 09:45:08 +0800 Received: from [127.0.0.1] (10.177.18.75) by szxeml410-hub.china.huawei.com (10.82.67.137) with Microsoft SMTP Server id 14.3.158.1; Fri, 27 Dec 2013 09:45:09 +0800 Message-ID: <52BCDBA4.9050607@huawei.com> Date: Fri, 27 Dec 2013 09:45:08 +0800 From: Wang Weidong User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: , , CC: , , Sergei Shtylyov Subject: [PATCH net-next v3 2/2] tipc: make the code look more readable References: <1387263827-20876-1-git-send-email-wangweidong1@huawei.com> <1387263827-20876-3-git-send-email-wangweidong1@huawei.com> In-Reply-To: <1387263827-20876-3-git-send-email-wangweidong1@huawei.com> X-Originating-IP: [10.177.18.75] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In commit 3b8401fe9d ("tipc: kill unnecessary goto's") didn't make the code look most readable, so fix it. This patch is cosmetic and does not change the operation of TIPC in any way. v3: fix the spelling error which pointed out by Sergei. v2: fix the problem "Referring commit purely by SHA1 ID is ambiguous" which pointed out by David. Suggested-by: David Laight Signed-off-by: Wang Weidong --- net/tipc/socket.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 83f466e..5efdeef 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -751,13 +751,10 @@ static int send_stream(struct kiocb *iocb, struct socket *sock, /* Handle special cases where there is no connection */ if (unlikely(sock->state != SS_CONNECTED)) { - res = -ENOTCONN; - if (sock->state == SS_UNCONNECTED) res = send_packet(NULL, sock, m, total_len); - else if (sock->state == SS_DISCONNECTING) - res = -EPIPE; - + else + res = sock->state == SS_DISCONNECTING ? -EPIPE : -ENOTCONN; goto exit; }