From patchwork Fri Dec 27 02:09:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangweidong X-Patchwork-Id: 305330 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 172B12C0090 for ; Fri, 27 Dec 2013 13:11:43 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754032Ab3L0CLX (ORCPT ); Thu, 26 Dec 2013 21:11:23 -0500 Received: from szxga01-in.huawei.com ([119.145.14.64]:53611 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754011Ab3L0CLX (ORCPT ); Thu, 26 Dec 2013 21:11:23 -0500 Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BPC65988; Fri, 27 Dec 2013 10:11:05 +0800 (CST) Received: from SZXEML412-HUB.china.huawei.com (10.82.67.91) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.3.158.1; Fri, 27 Dec 2013 10:09:39 +0800 Received: from [127.0.0.1] (10.177.18.75) by szxeml412-hub.china.huawei.com (10.82.67.91) with Microsoft SMTP Server id 14.3.158.1; Fri, 27 Dec 2013 10:09:39 +0800 Message-ID: <52BCE163.2060706@huawei.com> Date: Fri, 27 Dec 2013 10:09:39 +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 , Ying Xue Subject: [PATCH net-next RESEND v3] 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> <52BCDBA4.9050607@huawei.com> In-Reply-To: <52BCDBA4.9050607@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. Suggested-by: David Laight Signed-off-by: Wang Weidong --- Change note: 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. --- 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; }