Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp899920pxj; Fri, 4 Jun 2021 00:37:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+7fwkgjm5LAcuj5Vpx9aA6+5i36enIv7it4UJN2Xduc6mqPmTMIGwVKKaTcpm12ta8nRo X-Received: by 2002:a17:906:3818:: with SMTP id v24mr2851824ejc.197.1622792239395; Fri, 04 Jun 2021 00:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622792239; cv=none; d=google.com; s=arc-20160816; b=oFLo344Z3c0Qq1PHRVIIW853GQEu688UoYwkuDL7ou6dknCsOGvPIA/f+gGXt2p6Mr cHq7Njp5zrvDxJyApuHCynhIXKVSWYWJvtu/41EGPfpKl83HwqOhU1OElPE4KLAuE6MK MIS6pa+AVmE8xYf5i68e59CP2OERGXM0vKI2jdfNYQcutF0/Ngn3x8q8pnud30dQ/SGt kl6gYHL5+wlTHkeL/DM6kk+PkYzSigk8FbwPjpsU9hVawtMnUOimlP88hsZa2pULu2iH Q9pB5EGYnV4wjsRGIuYRdMXOKyBz2kF4l88zKlRjRwGy+4UQLGiltoAerGmJpWyXAbB4 E7aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=KgzDuMQlC3FT3TOwJPRdvhnvrDONivgwT+sPmXXhLdA=; b=K/eTQV3mHwSEnaAaJNEQk3LuW5lu4yqeaRiqnQ6fo3TVZ7EcIwR1U7KVu9wpYhk8xR /k06PZZ7kO63B8OPxR6JOr9j6cLIzFoonpO/9+AT4BTgKXNSTQJ6mxsGKRwet6J8xjnr WJN9ASzl/BhsQ8ATt2GTHPQ3QN5wjRhwrXdPnYbY8vWpXuK00VCTPsEexzNx6Tx3uRmD RVw/HV3qdvJPoFUaHwzhxl999XOvmzGHSEGYFZaJOFQ9ltJL4DjdzxwmtJLv1LHNF83M sFOV1uUK2Nxf0aoOEusKvewgSERWVwC8UsxkhsjIXvQNC6ycA9f2BqH+MZ9XwEIHgKQi uecg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si4522180edc.522.2021.06.04.00.36.56; Fri, 04 Jun 2021 00:37:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230150AbhFDHhI (ORCPT + 99 others); Fri, 4 Jun 2021 03:37:08 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3424 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230041AbhFDHhG (ORCPT ); Fri, 4 Jun 2021 03:37:06 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4FxDxG6KFdz6vGn; Fri, 4 Jun 2021 15:32:18 +0800 (CST) Received: from dggemi759-chm.china.huawei.com (10.1.198.145) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Fri, 4 Jun 2021 15:35:18 +0800 Received: from localhost.localdomain (10.67.165.24) by dggemi759-chm.china.huawei.com (10.1.198.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 4 Jun 2021 15:35:17 +0800 From: Guangbin Huang To: , , , , CC: , , , Subject: [PATCH net-next 3/6] net: hdlc_x25: move out assignment in if condition Date: Fri, 4 Jun 2021 15:32:09 +0800 Message-ID: <1622791932-49876-4-git-send-email-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1622791932-49876-1-git-send-email-huangguangbin2@huawei.com> References: <1622791932-49876-1-git-send-email-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggemi759-chm.china.huawei.com (10.1.198.145) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Li Should not use assignment in if condition. Signed-off-by: Peng Li Signed-off-by: Guangbin Huang --- drivers/net/wan/hdlc_x25.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c index 525eb42..24fdb6c 100644 --- a/drivers/net/wan/hdlc_x25.c +++ b/drivers/net/wan/hdlc_x25.c @@ -137,13 +137,15 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) switch (skb->data[0]) { case X25_IFACE_DATA: /* Data to be transmitted */ skb_pull(skb, 1); - if ((result = lapb_data_request(dev, skb)) != LAPB_OK) + result = lapb_data_request(dev, skb); + if (result != LAPB_OK) dev_kfree_skb(skb); spin_unlock_bh(&x25st->up_lock); return NETDEV_TX_OK; case X25_IFACE_CONNECT: - if ((result = lapb_connect_request(dev))!= LAPB_OK) { + result = lapb_connect_request(dev); + if (result != LAPB_OK) { if (result == LAPB_CONNECTED) /* Send connect confirm. msg to level 3 */ x25_connected(dev, 0); @@ -154,7 +156,8 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) break; case X25_IFACE_DISCONNECT: - if ((result = lapb_disconnect_request(dev)) != LAPB_OK) { + result = lapb_disconnect_request(dev); + if (result != LAPB_OK) { if (result == LAPB_NOTCONNECTED) /* Send disconnect confirm. msg to level 3 */ x25_disconnected(dev, 0); @@ -237,7 +240,8 @@ static int x25_rx(struct sk_buff *skb) hdlc_device *hdlc = dev_to_hdlc(dev); struct x25_state *x25st = state(hdlc); - if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { + skb = skb_share_check(skb, GFP_ATOMIC); + if (!skb) { dev->stats.rx_dropped++; return NET_RX_DROP; } @@ -333,8 +337,9 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr) if (result) return result; - if ((result = attach_hdlc_protocol(dev, &proto, - sizeof(struct x25_state)))) + result = attach_hdlc_protocol(dev, &proto, + sizeof(struct x25_state)); + if (result) return result; memcpy(&state(hdlc)->settings, &new_settings, size); -- 2.8.1