From patchwork Thu Aug 22 04:32:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13772643 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2D4F25779 for ; Thu, 22 Aug 2024 04:25:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300722; cv=none; b=A90EzwhNQNBFfIUFyZCpeOIIXSsg850Bax08b3LmkI3xWt+lAKWmrnG8oU6xBdS2fVBMgqgQmuUII+LjVwc0K7fYD4gHsCtG46uxzhyt5SBsV0m5Nz0XiEWe4Suc3qw7F9VQDctJ0wStIHeiL8FdZNyeWAVQ138UdWuJVLrFXNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300722; c=relaxed/simple; bh=ea0y8yWVi43P0vkxaiRf1+gteNi0hb+tnfAaMPtD1Co=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rc7VM105YKLHvaorCWkqFd12E5145ETGJUqnmFRQRcyZlEufD5OxzFaXU7S1ywwsQuIFJO3uXvfzYd+9qde1Zx1Kgd4E5NDHJTGYCdS18hrTETsJUHmSSTw45X6YHD9VsqBoRZ6nJpnB7Lvu5E3cxjATdSBj9ydoN45qo/0NhBw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Wq95S0ztXz1HH4V; Thu, 22 Aug 2024 12:22:04 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id 02F621401E9; Thu, 22 Aug 2024 12:25:17 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 12:25:16 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next 01/10] net: vxlan: delete redundant judgment statements Date: Thu, 22 Aug 2024 12:32:43 +0800 Message-ID: <20240822043252.3488749-2-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822043252.3488749-1-lizetao1@huawei.com> References: <20240822043252.3488749-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd500012.china.huawei.com (7.221.188.25) X-Patchwork-Delegate: kuba@kernel.org The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise. Signed-off-by: Li Zetao Reviewed-by: Petr Machata --- drivers/net/vxlan/vxlan_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 8983e75e9881..34391c18bba7 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -277,8 +277,7 @@ static void __vxlan_fdb_notify(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb, rtnl_notify(skb, net, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC); return; errout: - if (err < 0) - rtnl_set_sk_err(net, RTNLGRP_NEIGH, err); + rtnl_set_sk_err(net, RTNLGRP_NEIGH, err); } static void vxlan_fdb_switchdev_notifier_info(const struct vxlan_dev *vxlan, From patchwork Thu Aug 22 04:32:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13772645 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2DBD381B8 for ; Thu, 22 Aug 2024 04:25:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300723; cv=none; b=bWnd1KnizhgRppLK7P2YyX0VrDYbQeXrsDa2/g1cd6qZUbDrIcdC9gEkElxVCpz8UNa/BVBW+Qkc6j72H3UO8pZrdDdX6cLQHyi6PG/X+YT15Rw2tBMfRvLyCa2h1MZ56f4ji/Xp7hOcPopNN8JSKmUHB0k1sMMs026sxJypjHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300723; c=relaxed/simple; bh=P8kyva4Coy5jhYkR+YUBJlGGMR7KXbJ9fBg8YpHLPnc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gvI4BeOICYFh3oSN0rsUqJVXCAbKOH7Xm7UuGAZY1JKTvY8FIIvk37OqKSfNoJajeHJpj+TQNfxQxIJIBV+0h9P6b5OOhMHfj8JDqg2OnapnC8fNcXO+RgaNQeiU9EplwrQVxWMKu4hRnyKfUu4rCk96yVNMYFyRcUz0vtI1ot8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Wq95S6D4vz1HH4b; Thu, 22 Aug 2024 12:22:04 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id B61031A0188; Thu, 22 Aug 2024 12:25:17 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 12:25:16 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next 02/10] fib: rules: delete redundant judgment statements Date: Thu, 22 Aug 2024 12:32:44 +0800 Message-ID: <20240822043252.3488749-3-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822043252.3488749-1-lizetao1@huawei.com> References: <20240822043252.3488749-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd500012.china.huawei.com (7.221.188.25) X-Patchwork-Delegate: kuba@kernel.org The initial value of err is -ENOMEM, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise. Signed-off-by: Li Zetao Reviewed-by: Petr Machata --- net/core/fib_rules.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 6ebffbc63236..3c76b835493d 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -1205,8 +1205,7 @@ static void notify_rule_change(int event, struct fib_rule *rule, rtnl_notify(skb, net, pid, ops->nlgroup, nlh, GFP_KERNEL); return; errout: - if (err < 0) - rtnl_set_sk_err(net, ops->nlgroup, err); + rtnl_set_sk_err(net, ops->nlgroup, err); } static void attach_rules(struct list_head *rules, struct net_device *dev) From patchwork Thu Aug 22 04:32:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13772651 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E70A225779 for ; Thu, 22 Aug 2024 04:25:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300728; cv=none; b=NO1aEeS453pnr+Bzc1sd8Td7ECQXs40QkTERROhs1SYkxlPD3CSYHeyLphIReu4/Z8377TBycBuznlDqpL3KcMwO+0bbSRHe2+20CpaUbXMFM666f9Cxjh60dOPROZjr0lGqFIl2iQGoJjPks8Swml46yeGCr8WOmmjxdImfswM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300728; c=relaxed/simple; bh=c+aiDkG5K9O38mRIHTq0MT6frypsrKgZPpCWDP4OHbI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ucQulw62RogUNXw30Ymoa0To75ZvLATY0mUSYv7pd4RIwS2RGuvzrzkDzufdKB2AcCrvoQcqZo0SnUw5HVXLkxNT0v5mJ2APlk2LQmY9WiXJ1jmdbG9eRyyuwHCmf4F4blAN2zrR/zG2brXbbFEDxWjZ6Fx3ozfcm6EVCqzZQJ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Wq96z4cRLz1xvGH; Thu, 22 Aug 2024 12:23:23 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id 7B4B91A0188; Thu, 22 Aug 2024 12:25:18 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 12:25:17 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next 03/10] neighbour: delete redundant judgment statements Date: Thu, 22 Aug 2024 12:32:45 +0800 Message-ID: <20240822043252.3488749-4-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822043252.3488749-1-lizetao1@huawei.com> References: <20240822043252.3488749-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd500012.china.huawei.com (7.221.188.25) X-Patchwork-Delegate: kuba@kernel.org The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise. Signed-off-by: Li Zetao Reviewed-by: Petr Machata --- net/core/neighbour.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/neighbour.c b/net/core/neighbour.c index a6fe88eca939..77b819cd995b 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -3530,8 +3530,7 @@ static void __neigh_notify(struct neighbour *n, int type, int flags, rtnl_notify(skb, net, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC); return; errout: - if (err < 0) - rtnl_set_sk_err(net, RTNLGRP_NEIGH, err); + rtnl_set_sk_err(net, RTNLGRP_NEIGH, err); } void neigh_app_ns(struct neighbour *n) From patchwork Thu Aug 22 04:32:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13772650 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C41395589C for ; Thu, 22 Aug 2024 04:25:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300728; cv=none; b=IGkJs+zEVDzm5Ia/yacYG32EBArRg1st/GvaYnG23yxC5C+9Yz7CnBfqaXmNl6cK4vlz8CNf3/1yaB3/Tq4qKCKy5it1jj9Rs7sjoLCNkGu6bCtYwrcOaFvVwhUk/yXYj+14ecllSJAwp3nmhWAQqNWcB/s+gf2730r4f1Sxk6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300728; c=relaxed/simple; bh=wMyf1bv1213SMmHHMV/KhyOOMqVLrkARxj6RQaC1HZY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OvF3co7dNu1szqsuPfJG/pv09xeg8uoMsdOReYw0bKpM7XAtxynDAnyeV8O2ckZic2tBujC8HScQZ+a2Yox/o69rvgTxxw52S/hp9Ln74fQiakjQCUky4mT7dvdJh1JV6VLFbaBPi+FSh1H3HyYuCxOukpjrPFnK053Ge9XBx8w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Wq96t1wPnzhXq2; Thu, 22 Aug 2024 12:23:18 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id 2CD501800A4; Thu, 22 Aug 2024 12:25:19 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 12:25:18 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next 04/10] rtnetlink: delete redundant judgment statements Date: Thu, 22 Aug 2024 12:32:46 +0800 Message-ID: <20240822043252.3488749-5-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822043252.3488749-1-lizetao1@huawei.com> References: <20240822043252.3488749-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd500012.china.huawei.com (7.221.188.25) X-Patchwork-Delegate: kuba@kernel.org The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise. Signed-off-by: Li Zetao Reviewed-by: Petr Machata --- net/core/rtnetlink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 73fd7f543fd0..cd9487a12d1a 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -4087,8 +4087,7 @@ struct sk_buff *rtmsg_ifinfo_build_skb(int type, struct net_device *dev, } return skb; errout: - if (err < 0) - rtnl_set_sk_err(net, RTNLGRP_LINK, err); + rtnl_set_sk_err(net, RTNLGRP_LINK, err); return NULL; } From patchwork Thu Aug 22 04:32:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13772646 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40D1838DC0 for ; Thu, 22 Aug 2024 04:25:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300723; cv=none; b=vDBTkZvdj8Ls0RsdDGJ955ii1ANuZwKI7qF0O6E4CbAe6cVJhZ+WDJoP519mDwTFIjEwnYK7ydJRf34Y/gV36Yi/4QNGZWiVpMKaC3XdjcIvzsV9XBTZvolI/KOL5J99Z58LY6a1qY/9KcE+L3JsQkjEzebSY+tMH1krpaZuV1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300723; c=relaxed/simple; bh=XAEv2w1uDssPxnHVjUZwz+ke1nXgokU6gXhLWhPVKJQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YosT0d4IPuEeZ6qVQWTZO2rvvkAIoif18gGqseKpTyJyUV/1asI1YxSrQJKjqGfLV3ZJMtXIMDN0bNGH1kba/PhhTGt52cV7wPVB1ZOc9TJx9Myab6+EPTRtilPGFqGcOLGdrw614XzMMp6ZhNuJoaAFCy2r2YlsNDjWQy3tYeA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Wq9980L9Qz1S8W3; Thu, 22 Aug 2024 12:25:16 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id D78BD1400DD; Thu, 22 Aug 2024 12:25:19 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 12:25:19 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next 05/10] ipv4: delete redundant judgment statements Date: Thu, 22 Aug 2024 12:32:47 +0800 Message-ID: <20240822043252.3488749-6-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822043252.3488749-1-lizetao1@huawei.com> References: <20240822043252.3488749-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd500012.china.huawei.com (7.221.188.25) X-Patchwork-Delegate: kuba@kernel.org The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise. Signed-off-by: Li Zetao Reviewed-by: Petr Machata --- net/ipv4/devinet.c | 6 ++---- net/ipv4/fib_semantics.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 61be85154dd1..ab76744383cf 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -1943,8 +1943,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh, rtnl_notify(skb, net, portid, RTNLGRP_IPV4_IFADDR, nlh, GFP_KERNEL); return; errout: - if (err < 0) - rtnl_set_sk_err(net, RTNLGRP_IPV4_IFADDR, err); + rtnl_set_sk_err(net, RTNLGRP_IPV4_IFADDR, err); } static size_t inet_get_link_af_size(const struct net_device *dev, @@ -2140,8 +2139,7 @@ void inet_netconf_notify_devconf(struct net *net, int event, int type, rtnl_notify(skb, net, 0, RTNLGRP_IPV4_NETCONF, NULL, GFP_KERNEL); return; errout: - if (err < 0) - rtnl_set_sk_err(net, RTNLGRP_IPV4_NETCONF, err); + rtnl_set_sk_err(net, RTNLGRP_IPV4_NETCONF, err); } static const struct nla_policy devconf_ipv4_policy[NETCONFA_MAX+1] = { diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 0f70341cb8b5..ba2df3d2ac15 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -543,8 +543,7 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, info->nlh, GFP_KERNEL); return; errout: - if (err < 0) - rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err); + rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err); } static int fib_detect_death(struct fib_info *fi, int order, From patchwork Thu Aug 22 04:32:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13772648 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DC7A25779 for ; Thu, 22 Aug 2024 04:25:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300726; cv=none; b=OsYs2hhwGFUju/j7ENHhM1JK7eIq8Sp9wDlNNWq4eCVTsSYWUxTvVw0odz0K9Mr6e1SPJTkS8JvGYBL8z43RuUITzZieNPknQCv8XRDllu+3TKTD58wE/fqg24d8lHexjc6mWA8VmTEuq6UxCVG5dvVLkbY776xHz1WXrBzpNJg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300726; c=relaxed/simple; bh=HpEXZwkaVCozQm5PqDRQw2utBK3tbGp8FRPGUnNgIuU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jVFQIPbVgWOslFoc2zUsmGDW2sBlO4lzLw2anmXA3QRQszUJWBGfnbhPvXZ7QzdvFSUIT3aPTO35AHwFRrSR4G5iTbwoXdCTy2beGrAIB6sU3mZ3EVWuCv7dkMnET5ViG1uPAE+xgvzfgyLL8TXo2bvRx37Qyg7KaMQF13xuTqo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Wq98n18nMzyR7B; Thu, 22 Aug 2024 12:24:57 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id 95C85140134; Thu, 22 Aug 2024 12:25:20 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 12:25:19 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next 06/10] ipmr: delete redundant judgment statements Date: Thu, 22 Aug 2024 12:32:48 +0800 Message-ID: <20240822043252.3488749-7-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822043252.3488749-1-lizetao1@huawei.com> References: <20240822043252.3488749-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd500012.china.huawei.com (7.221.188.25) X-Patchwork-Delegate: kuba@kernel.org The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise. Signed-off-by: Li Zetao Reviewed-by: Petr Machata --- net/ipv4/ipmr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 6c750bd13dd8..6e38bb0ef735 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -2406,8 +2406,7 @@ static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc, errout: kfree_skb(skb); - if (err < 0) - rtnl_set_sk_err(net, RTNLGRP_IPV4_MROUTE, err); + rtnl_set_sk_err(net, RTNLGRP_IPV4_MROUTE, err); } static size_t igmpmsg_netlink_msgsize(size_t payloadlen) From patchwork Thu Aug 22 04:32:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13772647 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 868363BB32 for ; Thu, 22 Aug 2024 04:25:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300725; cv=none; b=N8yqMC90awya+SzhAkOXdRJ/wtVMPNlji1EYzxR2RkTJvennVGoqQovrqyGF5fg6GromGT1oeQVAvlIy1l+s1CeOX/fbs2IkP2x9mNVpimyDt867I7DrWgK274axI5dyZmKJDNhfNTH4LeBbnwoFEy3uh9PsHPPaF5vBY7BQa4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300725; c=relaxed/simple; bh=zR2bKrgMPbv7xIYtto+QcPT3oWiL8h3YJzYAef6wXLI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mk5fRZMDdDPWeAHaQHkt/A2WoONV9VO92HyM00tcU1EOb005Enw/E5xPU9NRQYa7VQIM9ir3wZibL2dKSFMueU3XrC/60Z6JqOsOcfAwROt0qR5BzcV8Voh7N2Hmng93DMAgXTdWnDH7ndZhDVwfmkpModPCSllL9DF7gU3tcwA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Wq9993d46z1S8Vw; Thu, 22 Aug 2024 12:25:17 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id 52A1B1401E9; Thu, 22 Aug 2024 12:25:21 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 12:25:20 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next 07/10] net: nexthop: delete redundant judgment statements Date: Thu, 22 Aug 2024 12:32:49 +0800 Message-ID: <20240822043252.3488749-8-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822043252.3488749-1-lizetao1@huawei.com> References: <20240822043252.3488749-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd500012.china.huawei.com (7.221.188.25) X-Patchwork-Delegate: kuba@kernel.org The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise. Signed-off-by: Li Zetao Reviewed-by: Petr Machata --- net/ipv4/nexthop.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index 9db10d409074..93aaea0006ba 100644 --- a/net/ipv4/nexthop.c +++ b/net/ipv4/nexthop.c @@ -1090,8 +1090,7 @@ static void nexthop_notify(int event, struct nexthop *nh, struct nl_info *info) info->nlh, gfp_any()); return; errout: - if (err < 0) - rtnl_set_sk_err(info->nl_net, RTNLGRP_NEXTHOP, err); + rtnl_set_sk_err(info->nl_net, RTNLGRP_NEXTHOP, err); } static unsigned long nh_res_bucket_used_time(const struct nh_res_bucket *bucket) @@ -1211,8 +1210,7 @@ static void nexthop_bucket_notify(struct nh_res_table *res_table, rtnl_notify(skb, nh->net, 0, RTNLGRP_NEXTHOP, NULL, GFP_KERNEL); return; errout: - if (err < 0) - rtnl_set_sk_err(nh->net, RTNLGRP_NEXTHOP, err); + rtnl_set_sk_err(nh->net, RTNLGRP_NEXTHOP, err); } static bool valid_group_nh(struct nexthop *nh, unsigned int npaths, From patchwork Thu Aug 22 04:32:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13772652 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5ECDC73440 for ; Thu, 22 Aug 2024 04:25:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300731; cv=none; b=BtRAJBFO2ty/aZNJkHyeX2pYXrTQs7ZaV32snOjm59lbsvaCt8V83pPJou5TmSfKmVuwvuFat8QUJo/KUOTljCEC3MY9Vooiq8UeX2QnI92Z0Pc0TAevWauH464fl2hu9VN5Ruu9cAThlb+JY85ZUdiNcM3dHHEAMRfljFshuQo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300731; c=relaxed/simple; bh=5kvbSa/2EW0mp+PNt/yNQok+X2Qj+Jymf1OjBCHmUUg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nisu08crHoqWH0nnQp5Id86DpKLAw0CJmziNvPgFlAdJPJZ40N0VyVoD79MI7e8ecrJHHsJcz4ti8K3icDJ3UPrUwWbhYzV8L2YREonykzuuYNqU1F1Q4O3wvQmLgB4S+8W1j8hWcxqi95+kvLEiq1WCX3TZh5sK5LdAQMaEkvU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Wq9731JK2z1xvll; Thu, 22 Aug 2024 12:23:27 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id 09B79140447; Thu, 22 Aug 2024 12:25:22 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 12:25:21 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next 08/10] ip6mr: delete redundant judgment statements Date: Thu, 22 Aug 2024 12:32:50 +0800 Message-ID: <20240822043252.3488749-9-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822043252.3488749-1-lizetao1@huawei.com> References: <20240822043252.3488749-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd500012.china.huawei.com (7.221.188.25) X-Patchwork-Delegate: kuba@kernel.org The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise. Signed-off-by: Li Zetao Reviewed-by: Petr Machata --- net/ipv6/ip6mr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index dd342e6ecf3f..e3ee93c562c3 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -2431,8 +2431,7 @@ static void mr6_netlink_event(struct mr_table *mrt, struct mfc6_cache *mfc, errout: kfree_skb(skb); - if (err < 0) - rtnl_set_sk_err(net, RTNLGRP_IPV6_MROUTE, err); + rtnl_set_sk_err(net, RTNLGRP_IPV6_MROUTE, err); } static size_t mrt6msg_netlink_msgsize(size_t payloadlen) From patchwork Thu Aug 22 04:32:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13772653 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8736E25779 for ; Thu, 22 Aug 2024 04:25:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300732; cv=none; b=t67/92LvwSvfyrRYU6djxPBI4VjkkA/ZwlX1f4e//UmXEiBpKM4ZBBt2FdiYrpXqI8zSLWa38gGK1+AcIVYBH+wMzsn5VnRIg7CkEKBfaakFDLe86oJ54phOXI4zpWzhevgSY6FX/WxHmzpXso1pL7saq5GWMz4xXahsFONphEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300732; c=relaxed/simple; bh=pBECfmK17ma/wh006e2wlp9CSJ8r20xXZ/HqYSJXmrI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UjUNmVteF0RyLZZHXgHggSg72HEFVt8sSo2xvo1ileljzmqNiTeEZugb0povze/Zdhm3amdvX/B7vPLzqbQs+0HEilvQX8gFmv7zKmzRbyANTLXZSU/2LpZqRM2UpOa0OPpq47+iDwB6ZhUN4NvrcSnB3Ty3qgKUV9ZMsUvAWrY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Wq9736L77z1xvln; Thu, 22 Aug 2024 12:23:27 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id B6CA51A0188; Thu, 22 Aug 2024 12:25:22 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 12:25:21 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next 09/10] net/ipv6: delete redundant judgment statements Date: Thu, 22 Aug 2024 12:32:51 +0800 Message-ID: <20240822043252.3488749-10-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822043252.3488749-1-lizetao1@huawei.com> References: <20240822043252.3488749-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd500012.china.huawei.com (7.221.188.25) X-Patchwork-Delegate: kuba@kernel.org The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise. Signed-off-by: Li Zetao Reviewed-by: Petr Machata --- net/ipv6/route.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 219701caba1e..7e7de29ad05f 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -6193,8 +6193,7 @@ void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info, info->nlh, gfp_any()); return; errout: - if (err < 0) - rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err); + rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err); } void fib6_rt_update(struct net *net, struct fib6_info *rt, @@ -6220,8 +6219,7 @@ void fib6_rt_update(struct net *net, struct fib6_info *rt, info->nlh, gfp_any()); return; errout: - if (err < 0) - rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err); + rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err); } void fib6_info_hw_flags_set(struct net *net, struct fib6_info *f6i, From patchwork Thu Aug 22 04:32:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13772649 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6542B4D8B0 for ; Thu, 22 Aug 2024 04:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300727; cv=none; b=gmeBn8hK48Gsh5NIU1alsgGrpavoOTRmTZKC1NUG9gMH5E7gZK2GaPjSo2TMZt6ZYzXZZJhg1FTko4onVYtjob70uVNm4uiwaAUBXWFrutnWMMm+RHmYquhN/XGrFbN1XsmtHCy6bMbaBtUx72Ixb+0vCK1pzGvgmD1pzmIENNA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724300727; c=relaxed/simple; bh=zqJJwBVf5HwFBlIb1NLKcxKl9NGpt1mtdfa2ITi1SHk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EyAj/RPpcBBwrKxWBr7Qbx1m4yqIKrruEmrUDnRjVu6/VsanrwPlHynRRgt2NZF0jghwr3KsB8YnTa8+JnpB9X0bEzTcpp/WCnpRb51IsX31FEV5LeT1q16Rii/YgLuKdervL0sNh/23ocHcVzGqQBNFdbHZ9yUCWfyjZ8d7IKw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Wq95Z4Q2jz1HH3v; Thu, 22 Aug 2024 12:22:10 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id 7786D180019; Thu, 22 Aug 2024 12:25:23 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 12:25:22 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next 10/10] net: mpls: delete redundant judgment statements Date: Thu, 22 Aug 2024 12:32:52 +0800 Message-ID: <20240822043252.3488749-11-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822043252.3488749-1-lizetao1@huawei.com> References: <20240822043252.3488749-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd500012.china.huawei.com (7.221.188.25) X-Patchwork-Delegate: kuba@kernel.org The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise. Signed-off-by: Li Zetao Reviewed-by: Petr Machata --- net/mpls/af_mpls.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index 0e6c94a8c2bc..aba983531ed3 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c @@ -1201,8 +1201,7 @@ static void mpls_netconf_notify_devconf(struct net *net, int event, rtnl_notify(skb, net, 0, RTNLGRP_MPLS_NETCONF, NULL, GFP_KERNEL); return; errout: - if (err < 0) - rtnl_set_sk_err(net, RTNLGRP_MPLS_NETCONF, err); + rtnl_set_sk_err(net, RTNLGRP_MPLS_NETCONF, err); } static const struct nla_policy devconf_mpls_policy[NETCONFA_MAX + 1] = { @@ -2278,8 +2277,7 @@ static void rtmsg_lfib(int event, u32 label, struct mpls_route *rt, return; errout: - if (err < 0) - rtnl_set_sk_err(net, RTNLGRP_MPLS_ROUTE, err); + rtnl_set_sk_err(net, RTNLGRP_MPLS_ROUTE, err); } static int mpls_valid_getroute_req(struct sk_buff *skb,