From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 151EB41BE7; Mon, 6 Feb 2023 08:06:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 497AD42D40; Mon, 6 Feb 2023 08:06:19 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id 888C742D3E for ; Mon, 6 Feb 2023 08:06:17 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eFEtTuzAbc8cwG/LCYg2E8wuRLGsu3BllwF2rvP1ildpOvOCJ/S2d/aYlioCifhcsmlxXRd7PF9ZUTuBUWshhU/LjSNgMJb1HlndbDkB6uEYo4TtCQEw7/z4B9P37X3lCnZRY1LjABycWUB5YWBoxmjC+KcYQg5qQTDesnLPPqpL4fbzj+6t9tZRPfKf5ykIoNXTuDGWeJlFCReej5HSJRFfi0J3YaoTBSXB4zoGqqNKjQYdcSaXWbzzqelvJmwZoqOH9YgZKWBLBI7XGP/H+nYk+EFCB25eG2vHpTVP2A6vaW+y3OyZJoKoDlUmB1dEkIKVY3F78btBrBc+sa/7oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=80v5mXuNOdX4KAxgpIyCTbmuDSlIaswAtcMWCZ9qwvc=; b=TTWaB2joTJVCl7AU1tMkVlfY6bor4lob0zJROucdKA4W6eCspB7cRFilkyELDHP0Ho5bvnPu07MN4WgLIe69/YL8L8t7Q8gfc/n3WwLFQJ5skO2NX3rI9ywFhrvBM/7KPl8tin48XDDQPKWx0Mjciln+0VZF75IbQcCwntO4HqYuA0YIIt2Cv06r9J5aoZ5J1GDVu+iv0ni4KGivHy1hOD/OiCUJLGZvj6s+ecsHO45Q3JccPhVt0HnpyWSXFTXhgUbyvrDY/Y/NUgSZz1YpX31op+knSWWAkRq6XHds3APaDcaoN/DKzCtlOflS18G1ByEXbrGjsVRgF4I/uqKbsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=80v5mXuNOdX4KAxgpIyCTbmuDSlIaswAtcMWCZ9qwvc=; b=cQhpcBpVeWuu8qCfoAX6T9JVsGEXNF8Lx3PaFtmLDAe7zMhUvQlaoJzDhP5G2N2X0tmTB67C/WokjnHde5Y4P9S7upgwy3JSIAQb6F3LK+Ans0DR2QMf5u5R6Z+tqRIBp1t6YURCiYWx3/Ua+LHD6iwaUOOBd7UrD6MEmt2MPKY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by SJ0PR13MB5302.namprd13.prod.outlook.com (2603:10b6:a03:3dc::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 07:06:15 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d%4]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 07:06:15 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, James Hershaw , Chaoyong He Subject: [PATCH 3/3] net/nfp: explicitly compare to null and 0 Date: Mon, 6 Feb 2023 15:05:49 +0800 Message-Id: <20230206070549.27265-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20230206070549.27265-1-chaoyong.he@corigine.com> References: <20230206070549.27265-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR01CA0120.apcprd01.prod.exchangelabs.com (2603:1096:4:40::24) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SJ0PR13MB5302:EE_ X-MS-Office365-Filtering-Correlation-Id: d4ee296a-9823-4273-ebd8-08db0810a308 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6OZ8yx6O4mMKHozxLwf26SkAIxUXZA9RNKKnSpC/D9BeAGi01bHo558b1Ox9cQtHu5fp8uXsLGVEvhyIPokYNvY+Aj31J8VR8rzzaeaLuluJZN7Ly17L6deej3EqdndmK0lFTN17CK3Cll2VeO7y4LtwTt07P99TRhyfpHit2tZppHi1qWN3GDmFOpLOyALO8vFt9Bpnt4KEl4TJd92VDggcZkLGMWA2i6ssCEPnfkGM/fyldgwIUIW4/LEZPWroOLNuFzQE6jU69QWy5TJ3z+eMGJFMi0nGfOvkOCBgNQNkQ2N12Xp849J2WCumsV+M5vCvBadPqd6W4Q3WZdF6zUKSzYW377aQjJ8LHTjG/48jJtKieTPn2fD0BdiSRg61ZjKH4ZU+QFtb6ghaZn39jCJEritTovMn8iIK1bKpTyg6Ghz2RvKRWFd0R7nROxnBd1Q9+iqV5I8ROXUp54EaDbpaJTKiqHC6tm+WkxWCBy+s8EO0rg2ShAqu01Buznnkj9SzYcSE0ohY/213N1TGPwSRpQbrhDQcpSalvuqK0LEB3Jmx+WYLWzswnOdVCkNhGHsaLLoJrT226UoP/U70rWTONf4oTy+AiaZAMsHq5/5B4psU+cQIrakYM5zQCgHKtoc2C3s9ELnJhrMlhkGsXnwtCOgYISgiRCUkzfg776juN/89aVL3FcK51mPBnpyMJr0FTwBCANYMVuSf5F9/HA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(396003)(366004)(39840400004)(136003)(376002)(451199018)(52116002)(36756003)(316002)(107886003)(6666004)(54906003)(1076003)(6506007)(8676002)(6486002)(30864003)(5660300002)(8936002)(66476007)(66556008)(2906002)(6916009)(66946007)(4326008)(478600001)(44832011)(41300700001)(6512007)(26005)(38100700002)(86362001)(38350700002)(66574015)(83380400001)(186003)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Y2JLazhscFNuOTgvd1ljSHdaUmkxNHZxdUgvcVRpZmlmTEV5TnhXdTFuWjZ5?= =?utf-8?B?eTJlVEdvazJCaWFucndsSDFxS25Fem96enhTUWRMcjl5K0ZscUJIV1hVcjdU?= =?utf-8?B?VFNrOFhZanNHSFF4OGFVVWFKQVk1YlFRRWMzUzFMWkRSMDJIcGF2SUZHb1ZD?= =?utf-8?B?eDJ1VkM0VTFZZmN1bGxpQjlRd0NmT01VbHVRSVQzSHVhdGtLcG9FVEdXMU5a?= =?utf-8?B?ckkwV29wVE9CQ3loLzZNaHZlM3NCbHAyNkl2L2ZiVDJzVzFWb3JpYStFMXpL?= =?utf-8?B?YXF3Ymd1ZHRkOE9VdjRMUkZ0a0VRdVllSWxrZTFBdFB1VytHOGtlYlBPVlIw?= =?utf-8?B?a2wrcE9wVlJaVDhobGRqR0tFSEdtUENvSEdwcGpnN1c3RExsWUNPNzNCSDBr?= =?utf-8?B?WklrazdmZ0JoL0JFWnNZWmZxenVqSVpEQjl4WmozMi8xcnk4SUJXZEVKYUs1?= =?utf-8?B?NTNiTG1ORk9tUUpwRTlIL3I0Qkt6VWJhV1M2dzQ3allwZEJ2REtyZkZZMTVx?= =?utf-8?B?WEpCUUh6YmFFMWJDb290ZFRoSTJzKzRhV0RNcWlCdWw5Si9qQ1VXRmFtWXkx?= =?utf-8?B?R3RjOXF1Y28waDJkNnpUZDVPTXExN2gwRWErUDNHYUtLck1FOVY1K3dqSkpD?= =?utf-8?B?WTZnM0RqNWZYYTlDalpuYkRLMmgraXVCLzBRVzkybWZtOHZzTmFWOTVDVENC?= =?utf-8?B?T3gwWnQ1VUZySVY5TUdYNzdYeUxTdURtaVNxZzZyV2ZCRlJqT1Qra09URmVy?= =?utf-8?B?YUVOV3llYUorVjNZelNHUVhqYTZuQlZYNHg4NjgzdmN5cTI0Um5ZTldybExK?= =?utf-8?B?cVF5SDllbDZ6ayt4eTJLSkRmTklxbVFEOEMrTTNFZklvUUdOazBrV0d2T1Z4?= =?utf-8?B?T2VaOWhEcjVFUXRIc2hXMXpHZklGa0srSHlhTVR3NkxGZUEzWFVCT0lqQlZO?= =?utf-8?B?MEs1cWREV2g3K0UvVDlCQ0xEbE9MR1cxUWw1L3lmaC9QOXdlQWNvSGFlbXpU?= =?utf-8?B?Rlp0RnE0UFhCdUVmVmVKM2ZBTy9nNTdHZUVDdHV0cTZnUGtnV3NvQlM4cCtr?= =?utf-8?B?elZBVUpYOGRLUnl3Vk10MFNSNVE3dUEyZ1BUL2RVNFlZd0Zpa1YwWUlpZWZn?= =?utf-8?B?WmdIdEJ1NzArbXZCWEZETzdVU1k3UUwrOHJLYlhaQ0RNaVB0aG9jNDRJSS9R?= =?utf-8?B?QWo2ZHZ2MFNITDFsWG9yQ3Q3VVpJSU9WcThjUERWNk1UNTRhL3VVU0JwUWtU?= =?utf-8?B?Vk5uaEQ0QlB4cDA4a0hzTUhnbk9rSGczTFRTdDhualRZSzFsQlZ4Mmk2WTVy?= =?utf-8?B?VldiRXFQYmFjbVJ1Rm9QUmJQRDRta0hQRmZPR0tUeFA5WDYvcjd1ZHFVQkZZ?= =?utf-8?B?bjZRSmFYL1VnS05qS1A1cGRGcG5LL0V2clQwbnlnY2hoS21JOHRVcDN3aDZl?= =?utf-8?B?WFhlU29NUzkybllVZzlLN3gzNFEyck9GWFlub0o3N2lWNENNZDJrWEJsMTlW?= =?utf-8?B?a0QwSzQ3MjVUSlJGUDV1aWloWVFPdGZ3KzM3L1hyK1NOcTgzanZ0N3gvWng5?= =?utf-8?B?NVI0WW1HQ0MwTnJ4eHRsVGxJd3BlRGxJT0pnZzcxTHBPRENRVnZOVm5Pcjli?= =?utf-8?B?MVhiV0hSaDNNd2dIM09DeVZnVU56TTdaMkhld2xONHA1MkxnTVRpN2MxQ2lG?= =?utf-8?B?R0tjZ09LRkNmdXpQcmZaNE9BSkFjUm9LUnVMU0ZoWGdPeWJ2MGZHTWtyMHNx?= =?utf-8?B?dVBNdDVyeFYrN3BlWmdHQ2REMFU4MnJBeFhFUlRGc1FlUjZRdDczTWlBblBq?= =?utf-8?B?a1FoVnB6UU1BeGNJZWlPTzl3bk0yZWV6RUtGaFJMRFdubkFDRzZ4OFVLdnlF?= =?utf-8?B?dVQ5WUw4MnU5c3ZCa09QeCs2MGVvUnRKTkh1Z2VMOFhtZHc0QUg1aVUyc0Zn?= =?utf-8?B?Q1lLRXRtM2hCcTRpUm51cFIvNVJHVW1pc3VyUzNielBueEJuK1Vyb2g4TFFk?= =?utf-8?B?SWw3UzVkejRjUTVwczdJcnR4Q2lWRmF5bGJPdnBFTC9MZnF1KzZiNGluNlc1?= =?utf-8?B?emZ3OVFCN3BERngyMWFjWnRQR3Rxb1F0UkEyNHRIVkJYZ2YxRnBjTm8rOEdQ?= =?utf-8?B?cmJORWZwT3AxeTl2N3JPcWpMcllVdXdaWWNKUC9VRm00Q2xFc05wTGl2NFRu?= =?utf-8?B?b0E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d4ee296a-9823-4273-ebd8-08db0810a308 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 07:06:15.3794 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ge9Ac0Z25fUFUufzFCJ0Pzhd7sTkG63tOiMs5F71Hm3LRP8mdDtgU5Kla4ynjB9FBpRj2D+oTPAs0PxQP1/nD3N48HeCutGLx6YuAvg0BOA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR13MB5302 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: James Hershaw Removal of the '!' character when comparing variables in favour of explicitly comparing the variable to either 'NULL' or '0', in compliance with the standard. Signed-off-by: James Hershaw Reviewed-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_common.c | 24 +++++++++---------- drivers/net/nfp/nfp_cpp_bridge.c | 4 ++-- drivers/net/nfp/nfp_ethdev.c | 2 +- drivers/net/nfp/nfp_ethdev_vf.c | 2 +- drivers/net/nfp/nfp_rxtx.c | 14 +++++------ drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 16 ++++++------- drivers/net/nfp/nfpcore/nfp_cppcore.c | 28 +++++++++++----------- drivers/net/nfp/nfpcore/nfp_hwinfo.c | 6 ++--- drivers/net/nfp/nfpcore/nfp_mip.c | 4 ++-- drivers/net/nfp/nfpcore/nfp_mutex.c | 4 ++-- drivers/net/nfp/nfpcore/nfp_nffw.c | 10 ++++---- drivers/net/nfp/nfpcore/nfp_nsp.c | 6 ++--- drivers/net/nfp/nfpcore/nfp_nsp_cmds.c | 6 ++--- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 22 ++++++++--------- drivers/net/nfp/nfpcore/nfp_resource.c | 8 +++---- drivers/net/nfp/nfpcore/nfp_rtsym.c | 24 +++++++++---------- drivers/net/nfp/nfpcore/nfp_target.h | 2 +- 17 files changed, 91 insertions(+), 91 deletions(-) diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index f97264e9f0..c9401055d4 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -470,7 +470,7 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev) hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); } - if (!(hw->cap & NFP_NET_CFG_CTRL_PROMISC)) { + if ((hw->cap & NFP_NET_CFG_CTRL_PROMISC) == 0) { PMD_INIT_LOG(INFO, "Promiscuous mode not supported"); return -ENOTSUP; } @@ -1088,7 +1088,7 @@ nfp_net_dev_interrupt_handler(void *param) nfp_net_link_update(dev, 0); /* likely to up */ - if (!link.link_status) { + if (link.link_status == 0) { /* handle it 1 sec later, wait it being stable */ timeout = NFP_NET_LINK_UP_CHECK_TIMEOUT; /* likely to down */ @@ -1173,7 +1173,7 @@ nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask) update = NFP_NET_CFG_UPDATE_GEN; ret = nfp_net_reconfig(hw, new_ctrl, update); - if (!ret) + if (ret == 0) hw->ctrl = new_ctrl; return ret; @@ -1207,7 +1207,7 @@ nfp_net_rss_reta_write(struct rte_eth_dev *dev, shift = i % RTE_ETH_RETA_GROUP_SIZE; mask = (uint8_t)((reta_conf[idx].mask >> shift) & 0xF); - if (!mask) + if (mask == 0) continue; reta = 0; @@ -1216,7 +1216,7 @@ nfp_net_rss_reta_write(struct rte_eth_dev *dev, reta = nn_cfg_readl(hw, NFP_NET_CFG_RSS_ITBL + i); for (j = 0; j < 4; j++) { - if (!(mask & (0x1 << j))) + if ((mask & (0x1 << j)) == 0) continue; if (mask != 0xF) /* Clearing the entry bits */ @@ -1240,7 +1240,7 @@ nfp_net_reta_update(struct rte_eth_dev *dev, uint32_t update; int ret; - if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY)) + if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0) return -EINVAL; ret = nfp_net_rss_reta_write(dev, reta_conf, reta_size); @@ -1268,7 +1268,7 @@ nfp_net_reta_query(struct rte_eth_dev *dev, hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY)) + if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0) return -EINVAL; if (reta_size != NFP_NET_CFG_RSS_ITBL_SZ) { @@ -1288,13 +1288,13 @@ nfp_net_reta_query(struct rte_eth_dev *dev, shift = i % RTE_ETH_RETA_GROUP_SIZE; mask = (uint8_t)((reta_conf[idx].mask >> shift) & 0xF); - if (!mask) + if (mask == 0) continue; reta = nn_cfg_readl(hw, NFP_NET_CFG_RSS_ITBL + (idx * 64) + shift); for (j = 0; j < 4; j++) { - if (!(mask & (0x1 << j))) + if ((mask & (0x1 << j)) == 0) continue; reta_conf[idx].reta[shift + j] = (uint8_t)((reta >> (8 * j)) & 0xF); @@ -1366,7 +1366,7 @@ nfp_net_rss_hash_update(struct rte_eth_dev *dev, rss_hf = rss_conf->rss_hf; /* Checking if RSS is enabled */ - if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY)) { + if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0) { if (rss_hf != 0) { /* Enable RSS? */ PMD_DRV_LOG(ERR, "RSS unsupported"); return -EINVAL; @@ -1401,7 +1401,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY)) + if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0) return -EINVAL; rss_hf = rss_conf->rss_hf; @@ -1469,7 +1469,7 @@ nfp_net_rss_config_default(struct rte_eth_dev *dev) return ret; dev_conf = &dev->data->dev_conf; - if (!dev_conf) { + if (dev_conf == NULL) { PMD_DRV_LOG(INFO, "wrong rss conf"); return -EINVAL; } diff --git a/drivers/net/nfp/nfp_cpp_bridge.c b/drivers/net/nfp/nfp_cpp_bridge.c index e650fe9930..4aa36eb581 100644 --- a/drivers/net/nfp/nfp_cpp_bridge.c +++ b/drivers/net/nfp/nfp_cpp_bridge.c @@ -161,7 +161,7 @@ nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp *cpp) /* configure a CPP PCIe2CPP BAR for mapping the CPP target */ area = nfp_cpp_area_alloc_with_name(cpp, cpp_id, "nfp.cdev", nfp_offset, curlen); - if (!area) { + if (area == NULL) { RTE_LOG(ERR, PMD, "%s: area alloc fail\n", __func__); return -EIO; } @@ -261,7 +261,7 @@ nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp) while (count > 0) { area = nfp_cpp_area_alloc_with_name(cpp, cpp_id, "nfp.cdev", nfp_offset, curlen); - if (!area) { + if (area == NULL) { RTE_LOG(ERR, PMD, "%s: area alloc failed\n", __func__); return -EIO; } diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 31201c0197..f05c50ac88 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -652,7 +652,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); - if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR)) + if ((hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0) eth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR; eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index 4eea197f85..07a2e17ef8 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -417,7 +417,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); - if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR)) + if ((hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0) eth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR; eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index a5907cc428..79a66b6e44 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -186,7 +186,7 @@ nfp_net_parse_meta_hash(const struct nfp_meta_parsed *meta, hash = meta->hash; hash_type = meta->hash_type; } else { - if (!(rxd->rxd.flags & PCIE_DESC_RX_RSS)) + if ((rxd->rxd.flags & PCIE_DESC_RX_RSS) == 0) return; hash = rte_be_to_cpu_32(*(uint32_t *)NFP_HASH_OFFSET); @@ -1045,7 +1045,7 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk * Making the EOP, packets with just one segment * the priority */ - if (likely(!pkt_size)) + if (likely(pkt_size == 0)) txds->offset_eop = PCIE_DESC_TX_EOP; else txds->offset_eop = 0; @@ -1360,7 +1360,7 @@ nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, struct rte_mbuf *mb, uint64_t ol_flags; struct nfp_net_hw *hw = txq->hw; - if (!(hw->cap & NFP_NET_CFG_CTRL_TXCSUM)) + if ((hw->cap & NFP_NET_CFG_CTRL_TXCSUM) == 0) return flags; ol_flags = mb->ol_flags; @@ -1382,12 +1382,12 @@ nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, struct rte_mbuf *mb) struct nfp_net_nfdk_tx_desc txd; struct nfp_net_hw *hw = txq->hw; - if (!(hw->cap & NFP_NET_CFG_CTRL_LSO_ANY)) + if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) == 0) goto clean_txd; ol_flags = mb->ol_flags; - if (!(ol_flags & RTE_MBUF_F_TX_TCP_SEG)) + if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) == 0) goto clean_txd; txd.l3_offset = mb->l2_len; @@ -1476,7 +1476,7 @@ nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) && (pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) { type = NFDK_DESC_TX_TYPE_TSO; - } else if (!pkt->next && dma_len < NFDK_TX_MAX_DATA_PER_HEAD) { + } else if (pkt->next == NULL && dma_len < NFDK_TX_MAX_DATA_PER_HEAD) { type = NFDK_DESC_TX_TYPE_SIMPLE; } else { type = NFDK_DESC_TX_TYPE_GATHER; @@ -1532,7 +1532,7 @@ nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk dma_addr += dlen_type + 1; } - if (!pkt->next) + if (pkt->next == NULL) break; pkt = pkt->next; diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c index e818fcc8e8..d8d1293166 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c +++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c @@ -242,7 +242,7 @@ nfp_bar_write(struct nfp_pcie_user *nfp, struct nfp_bar *bar, base = bar->index >> 3; slot = bar->index & 7; - if (!nfp->cfg) + if (nfp->cfg == NULL) return (-ENOMEM); bar->csr = nfp->cfg + @@ -342,7 +342,7 @@ nfp_alloc_bar(struct nfp_pcie_user *nfp) } for (x = start; x > end; x--) { bar = &nfp->bar[x - 1]; - if (!bar->lock) { + if (bar->lock == 0) { bar->lock = 1; return bar; } @@ -459,7 +459,7 @@ nfp6000_area_acquire(struct nfp_cpp_area *area) } /* Must have been too big. Sub-allocate. */ - if (!priv->bar->iomem) + if (priv->bar->iomem == NULL) return (-ENOMEM); priv->iomem = priv->bar->iomem + priv->bar_offset; @@ -472,7 +472,7 @@ nfp6000_area_mapped(struct nfp_cpp_area *area) { struct nfp6000_area_priv *area_priv = nfp_cpp_area_priv(area); - if (!area_priv->iomem) + if (area_priv->iomem == NULL) return NULL; return area_priv->iomem; @@ -543,7 +543,7 @@ nfp6000_area_read(struct nfp_cpp_area *area, void *kernel_vaddr, return -EINVAL; } - if (!priv->bar) + if (priv->bar == NULL) return -EFAULT; if (is_64) @@ -608,7 +608,7 @@ nfp6000_area_write(struct nfp_cpp_area *area, const void *kernel_vaddr, return -EINVAL; } - if (!priv->bar) + if (priv->bar == NULL) return -EFAULT; if (is_64) @@ -680,7 +680,7 @@ nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc) lockfile = calloc(strlen(home_path) + strlen(lockname) + 1, sizeof(char)); - if (!lockfile) + if (lockfile == NULL) return -ENOMEM; strcat(lockfile, home_path); @@ -805,7 +805,7 @@ nfp6000_init(struct nfp_cpp *cpp, struct rte_pci_device *dev) struct nfp_pcie_user *desc; desc = malloc(sizeof(*desc)); - if (!desc) + if (desc == NULL) return -1; diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c index e1e0a143f9..72f50ace38 100644 --- a/drivers/net/nfp/nfpcore/nfp_cppcore.c +++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c @@ -51,7 +51,7 @@ nfp_cpp_model(struct nfp_cpp *cpp) int err; uint32_t model; - if (!cpp) + if (cpp == NULL) return NFP_CPP_MODEL_INVALID; err = __nfp_cpp_model_autodetect(cpp, &model); @@ -83,7 +83,7 @@ nfp_cpp_serial_set(struct nfp_cpp *cpp, const uint8_t *serial, free(cpp->serial); cpp->serial = malloc(serial_len); - if (!cpp->serial) + if (cpp->serial == NULL) return -1; memcpy(cpp->serial, serial, serial_len); @@ -95,7 +95,7 @@ nfp_cpp_serial_set(struct nfp_cpp *cpp, const uint8_t *serial, uint16_t nfp_cpp_interface(struct nfp_cpp *cpp) { - if (!cpp) + if (cpp == NULL) return NFP_CPP_INTERFACE(NFP_CPP_INTERFACE_TYPE_INVALID, 0, 0); return cpp->interface; @@ -140,7 +140,7 @@ nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest, uint64_t tmp64 = (uint64_t)address; int tmp, err; - if (!cpp) + if (cpp == NULL) return NULL; /* CPP bus uses only a 40-bit address */ @@ -154,12 +154,12 @@ nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest, address = (unsigned long long)tmp64; - if (!name) + if (name == NULL) name = ""; area = calloc(1, sizeof(*area) + cpp->op->area_priv_size + strlen(name) + 1); - if (!area) + if (area == NULL) return NULL; area->cpp = cpp; @@ -217,7 +217,7 @@ nfp_cpp_area_alloc_acquire(struct nfp_cpp *cpp, uint32_t destination, struct nfp_cpp_area *area; area = nfp_cpp_area_alloc(cpp, destination, address, size); - if (!area) + if (area == NULL) return NULL; if (nfp_cpp_area_acquire(area)) { @@ -404,7 +404,7 @@ nfp_xpb_to_cpp(struct nfp_cpp *cpp, uint32_t *xpb_addr) */ island = ((*xpb_addr) >> 24) & 0x3f; - if (!island) + if (island == 0) return xpb; if (island == 1) { @@ -555,11 +555,11 @@ nfp_cpp_alloc(struct rte_pci_device *dev, int driver_lock_needed) ops = nfp_cpp_transport_operations(); - if (!ops || !ops->init) + if (ops == NULL || ops->init == NULL) return NFP_ERRPTR(EINVAL); cpp = calloc(1, sizeof(*cpp)); - if (!cpp) + if (cpp == NULL) return NULL; cpp->op = ops; @@ -701,7 +701,7 @@ nfp_cpp_read(struct nfp_cpp *cpp, uint32_t destination, int err; area = nfp_cpp_area_alloc_acquire(cpp, destination, address, length); - if (!area) { + if (area == NULL) { PMD_DRV_LOG(ERR, "Area allocation/acquire failed"); return -1; } @@ -729,7 +729,7 @@ nfp_cpp_write(struct nfp_cpp *cpp, uint32_t destination, int err; area = nfp_cpp_area_alloc_acquire(cpp, destination, address, length); - if (!area) + if (area == NULL) return -1; err = nfp_cpp_area_write(area, 0, kernel_vaddr, length); @@ -841,11 +841,11 @@ nfp_cpp_map_area(struct nfp_cpp *cpp, int domain, int target, uint64_t addr, dest = NFP_CPP_ISLAND_ID(target, NFP_CPP_ACTION_RW, 0, domain); *area = nfp_cpp_area_alloc_acquire(cpp, dest, addr, size); - if (!*area) + if (*area == NULL) goto err_eio; res = nfp_cpp_area_iomem(*area); - if (!res) + if (res == NULL) goto err_release_free; return res; diff --git a/drivers/net/nfp/nfpcore/nfp_hwinfo.c b/drivers/net/nfp/nfpcore/nfp_hwinfo.c index 9b66569953..9054bb0315 100644 --- a/drivers/net/nfp/nfpcore/nfp_hwinfo.c +++ b/drivers/net/nfp/nfpcore/nfp_hwinfo.c @@ -101,7 +101,7 @@ nfp_hwinfo_try_fetch(struct nfp_cpp *cpp, size_t *cpp_size) } db = malloc(*cpp_size + 1); - if (!db) + if (db == NULL) return NULL; err = nfp_cpp_read(cpp, cpp_id, cpp_addr, db, *cpp_size); @@ -160,7 +160,7 @@ nfp_hwinfo_read(struct nfp_cpp *cpp) int err; db = nfp_hwinfo_fetch(cpp, &hwdb_size); - if (!db) + if (db == NULL) return NULL; err = nfp_hwinfo_db_validate(db, hwdb_size); @@ -183,7 +183,7 @@ nfp_hwinfo_lookup(struct nfp_hwinfo *hwinfo, const char *lookup) { const char *key, *val, *end; - if (!hwinfo || !lookup) + if (hwinfo == NULL || lookup == NULL) return NULL; end = hwinfo->data + hwinfo->size - sizeof(uint32_t); diff --git a/drivers/net/nfp/nfpcore/nfp_mip.c b/drivers/net/nfp/nfpcore/nfp_mip.c index d342bc4141..6b392ad5eb 100644 --- a/drivers/net/nfp/nfpcore/nfp_mip.c +++ b/drivers/net/nfp/nfpcore/nfp_mip.c @@ -71,7 +71,7 @@ nfp_mip_read_resource(struct nfp_cpp *cpp, struct nfp_mip *mip) int err; nffw_info = nfp_nffw_info_open(cpp); - if (!nffw_info) + if (nffw_info == NULL) return -ENODEV; err = nfp_nffw_info_mip_first(nffw_info, &cpp_id, &addr); @@ -101,7 +101,7 @@ nfp_mip_open(struct nfp_cpp *cpp) int err; mip = malloc(sizeof(*mip)); - if (!mip) + if (mip == NULL) return NULL; err = nfp_mip_read_resource(cpp, mip); diff --git a/drivers/net/nfp/nfpcore/nfp_mutex.c b/drivers/net/nfp/nfpcore/nfp_mutex.c index de9049c6a0..8a4e6a462a 100644 --- a/drivers/net/nfp/nfpcore/nfp_mutex.c +++ b/drivers/net/nfp/nfpcore/nfp_mutex.c @@ -153,7 +153,7 @@ nfp_cpp_mutex_alloc(struct nfp_cpp *cpp, int target, return NFP_ERRPTR(EEXIST); mutex = calloc(sizeof(*mutex), 1); - if (!mutex) + if (mutex == NULL) return NFP_ERRPTR(ENOMEM); mutex->cpp = cpp; @@ -205,7 +205,7 @@ nfp_cpp_mutex_owner(struct nfp_cpp_mutex *mutex) if (key != mutex->key) return NFP_ERRNO(EPERM); - if (!MUTEX_IS_LOCKED(value)) + if (MUTEX_IS_LOCKED(value) == 0) return 0; return MUTEX_INTERFACE(value); diff --git a/drivers/net/nfp/nfpcore/nfp_nffw.c b/drivers/net/nfp/nfpcore/nfp_nffw.c index 8bec0e3c9a..1382c4f6bf 100644 --- a/drivers/net/nfp/nfpcore/nfp_nffw.c +++ b/drivers/net/nfp/nfpcore/nfp_nffw.c @@ -123,13 +123,13 @@ nfp_nffw_info_open(struct nfp_cpp *cpp) int err; state = malloc(sizeof(*state)); - if (!state) + if (state == NULL) return NULL; memset(state, 0, sizeof(*state)); state->res = nfp_resource_acquire(cpp, NFP_RESOURCE_NFP_NFFW); - if (!state->res) + if (state->res == NULL) goto err_free; fwinf = &state->fwinf; @@ -143,7 +143,7 @@ nfp_nffw_info_open(struct nfp_cpp *cpp) if (err < (int)sizeof(*fwinf)) goto err_release; - if (!nffw_res_flg_init_get(fwinf)) + if (nffw_res_flg_init_get(fwinf) == 0) goto err_release; info_ver = nffw_res_info_version_get(fwinf); @@ -186,7 +186,7 @@ nfp_nffw_info_fwid_first(struct nfp_nffw_info *state) unsigned int cnt, i; cnt = nffw_res_fwinfos(&state->fwinf, &fwinfo); - if (!cnt) + if (cnt == 0) return NULL; for (i = 0; i < cnt; i++) @@ -211,7 +211,7 @@ nfp_nffw_info_mip_first(struct nfp_nffw_info *state, uint32_t *cpp_id, struct nffw_fwinfo *fwinfo; fwinfo = nfp_nffw_info_fwid_first(state); - if (!fwinfo) + if (fwinfo == NULL) return -EINVAL; *cpp_id = nffw_fwinfo_mip_cppid_get(fwinfo); diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.c b/drivers/net/nfp/nfpcore/nfp_nsp.c index 22fb3407c6..d8abaf1d52 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp.c @@ -58,7 +58,7 @@ nfp_nsp_print_extended_error(uint32_t ret_val) { int i; - if (!ret_val) + if (ret_val == 0) return; for (i = 0; i < (int)ARRAY_SIZE(nsp_errors); i++) @@ -115,11 +115,11 @@ nfp_nsp_open(struct nfp_cpp *cpp) int err; res = nfp_resource_acquire(cpp, NFP_RESOURCE_NSP); - if (!res) + if (res == NULL) return NULL; state = malloc(sizeof(*state)); - if (!state) { + if (state == NULL) { nfp_resource_release(res); return NULL; } diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c index 1de3d1b00f..15f6f7002d 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c @@ -34,7 +34,7 @@ __nfp_nsp_identify(struct nfp_nsp *nsp) return NULL; ni = malloc(sizeof(*ni)); - if (!ni) + if (ni == NULL) return NULL; memset(ni, 0, sizeof(*ni)); @@ -45,7 +45,7 @@ __nfp_nsp_identify(struct nfp_nsp *nsp) } nspi = malloc(sizeof(*nspi)); - if (!nspi) + if (nspi == NULL) goto exit_free; memset(nspi, 0, sizeof(*nspi)); @@ -80,7 +80,7 @@ nfp_hwmon_read_sensor(struct nfp_cpp *cpp, enum nfp_nsp_sensor_id id, long *val) int ret; nsp = nfp_nsp_open(cpp); - if (!nsp) + if (nsp == NULL) return -EIO; ret = nfp_nsp_read_sensors(nsp, BIT(id), &s, sizeof(s)); diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c index eb532e5f3a..578120636d 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c @@ -270,7 +270,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) const struct rte_ether_addr *mac; entries = malloc(NSP_ETH_TABLE_SIZE); - if (!entries) + if (entries == NULL) return NULL; memset(entries, 0, NSP_ETH_TABLE_SIZE); @@ -286,7 +286,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) for (i = 0; i < NSP_ETH_MAX_COUNT; i++) { mac = (const struct rte_ether_addr *)entries[i].mac_addr; if ((entries[i].port & NSP_ETH_PORT_LANES_MASK) && - (!rte_is_zero_ether_addr(mac))) + !rte_is_zero_ether_addr(mac)) cnt++; } @@ -302,7 +302,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) table_sz = sizeof(*table) + sizeof(struct nfp_eth_table_port) * cnt; table = malloc(table_sz); - if (!table) + if (table == NULL) goto err; memset(table, 0, table_sz); @@ -310,7 +310,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) for (i = 0, j = 0; i < NSP_ETH_MAX_COUNT; i++) { mac = (const struct rte_ether_addr *)entries[i].mac_addr; if ((entries[i].port & NSP_ETH_PORT_LANES_MASK) && - (!rte_is_zero_ether_addr(mac))) + !rte_is_zero_ether_addr(mac)) nfp_eth_port_translate(nsp, &entries[i], i, &table->ports[j++]); } @@ -344,7 +344,7 @@ nfp_eth_read_ports(struct nfp_cpp *cpp) struct nfp_nsp *nsp; nsp = nfp_nsp_open(cpp); - if (!nsp) + if (nsp == NULL) return NULL; ret = __nfp_eth_read_ports(nsp); @@ -361,12 +361,12 @@ nfp_eth_config_start(struct nfp_cpp *cpp, unsigned int idx) int ret; entries = malloc(NSP_ETH_TABLE_SIZE); - if (!entries) + if (entries == NULL) return NULL; memset(entries, 0, NSP_ETH_TABLE_SIZE); nsp = nfp_nsp_open(cpp); - if (!nsp) { + if (nsp == NULL) { free(entries); return nsp; } @@ -377,7 +377,7 @@ nfp_eth_config_start(struct nfp_cpp *cpp, unsigned int idx) goto err; } - if (!(entries[idx].port & NSP_ETH_PORT_LANES_MASK)) { + if ((entries[idx].port & NSP_ETH_PORT_LANES_MASK) == 0) { PMD_DRV_LOG(ERR, "trying to set port state on disabled port %d", idx); goto err; } @@ -454,7 +454,7 @@ nfp_eth_set_mod_enable(struct nfp_cpp *cpp, unsigned int idx, int enable) uint64_t reg; nsp = nfp_eth_config_start(cpp, idx); - if (!nsp) + if (nsp == NULL) return -1; entries = nfp_nsp_config_entries(nsp); @@ -494,7 +494,7 @@ nfp_eth_set_configured(struct nfp_cpp *cpp, unsigned int idx, int configed) uint64_t reg; nsp = nfp_eth_config_start(cpp, idx); - if (!nsp) + if (nsp == NULL) return -EIO; /* @@ -617,7 +617,7 @@ nfp_eth_set_fec(struct nfp_cpp *cpp, unsigned int idx, enum nfp_eth_fec mode) int err; nsp = nfp_eth_config_start(cpp, idx); - if (!nsp) + if (nsp == NULL) return -EIO; err = __nfp_eth_set_fec(nsp, mode); diff --git a/drivers/net/nfp/nfpcore/nfp_resource.c b/drivers/net/nfp/nfpcore/nfp_resource.c index fda03a6576..892ccf73c4 100644 --- a/drivers/net/nfp/nfpcore/nfp_resource.c +++ b/drivers/net/nfp/nfpcore/nfp_resource.c @@ -77,7 +77,7 @@ nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res) strlcpy(name_pad, res->name, sizeof(name_pad)); /* Search for a matching entry */ - if (!memcmp(name_pad, NFP_RESOURCE_TBL_NAME "\0\0\0\0\0\0\0\0", 8)) { + if (memcmp(name_pad, NFP_RESOURCE_TBL_NAME "\0\0\0\0\0\0\0\0", 8) == 0) { PMD_DRV_LOG(ERR, "Grabbing device lock not supported"); return -EOPNOTSUPP; } @@ -157,7 +157,7 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name) int count; res = malloc(sizeof(*res)); - if (!res) + if (res == NULL) return NULL; memset(res, 0, sizeof(*res)); @@ -167,7 +167,7 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name) dev_mutex = nfp_cpp_mutex_alloc(cpp, NFP_RESOURCE_TBL_TARGET, NFP_RESOURCE_TBL_BASE, NFP_RESOURCE_TBL_KEY); - if (!dev_mutex) { + if (dev_mutex == NULL) { free(res); return NULL; } @@ -178,7 +178,7 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name) for (;;) { err = nfp_resource_try_acquire(cpp, res, dev_mutex); - if (!err) + if (err == 0) break; if (err != -EBUSY) goto err_free; diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c index 288a37da60..850667adf8 100644 --- a/drivers/net/nfp/nfpcore/nfp_rtsym.c +++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c @@ -103,13 +103,13 @@ __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip) NFP_ISL_EMEM0; int err, n, size; - if (!mip) + if (mip == NULL) return NULL; nfp_mip_strtab(mip, &strtab_addr, &strtab_size); nfp_mip_symtab(mip, &symtab_addr, &symtab_size); - if (!symtab_size || !strtab_size || symtab_size % sizeof(*rtsymtab)) + if (symtab_size == 0 || strtab_size == 0 || symtab_size % sizeof(*rtsymtab) != 0) return NULL; /* Align to 64 bits */ @@ -117,14 +117,14 @@ __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip) strtab_size = round_up(strtab_size, 8); rtsymtab = malloc(symtab_size); - if (!rtsymtab) + if (rtsymtab == NULL) return NULL; size = sizeof(*cache); size += symtab_size / sizeof(*rtsymtab) * sizeof(struct nfp_rtsym); size += strtab_size + 1; cache = malloc(size); - if (!cache) + if (cache == NULL) goto exit_free_rtsym_raw; cache->cpp = cpp; @@ -164,7 +164,7 @@ __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip) int nfp_rtsym_count(struct nfp_rtsym_table *rtbl) { - if (!rtbl) + if (rtbl == NULL) return -EINVAL; return rtbl->num; @@ -180,7 +180,7 @@ nfp_rtsym_count(struct nfp_rtsym_table *rtbl) const struct nfp_rtsym * nfp_rtsym_get(struct nfp_rtsym_table *rtbl, int idx) { - if (!rtbl) + if (rtbl == NULL) return NULL; if (idx >= rtbl->num) @@ -201,7 +201,7 @@ nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name) { int n; - if (!rtbl) + if (rtbl == NULL) return NULL; for (n = 0; n < rtbl->num; n++) @@ -232,7 +232,7 @@ nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error) int err; sym = nfp_rtsym_lookup(rtbl, name); - if (!sym) { + if (sym == NULL) { err = -ENOENT; goto exit; } @@ -277,8 +277,8 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, PMD_DRV_LOG(DEBUG, "mapping symbol %s", name); sym = nfp_rtsym_lookup(rtbl, name); - if (!sym) { - PMD_DRV_LOG(ERR, "symbol lookup fails for %s", name); + if (sym == NULL) { + PMD_INIT_LOG(ERR, "symbol lookup fails for %s", name); return NULL; } @@ -290,8 +290,8 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, mem = nfp_cpp_map_area(rtbl->cpp, sym->domain, sym->target, sym->addr, sym->size, area); - if (!mem) { - PMD_DRV_LOG(ERR, "Failed to map symbol %s", name); + if (mem == NULL) { + PMD_INIT_LOG(ERR, "Failed to map symbol %s", name); return NULL; } PMD_DRV_LOG(DEBUG, "symbol %s with address %p", name, mem); diff --git a/drivers/net/nfp/nfpcore/nfp_target.h b/drivers/net/nfp/nfpcore/nfp_target.h index e8dcc9ad1e..d1e5a50b14 100644 --- a/drivers/net/nfp/nfpcore/nfp_target.h +++ b/drivers/net/nfp/nfpcore/nfp_target.h @@ -554,7 +554,7 @@ nfp_target_cpp(uint32_t cpp_island_id, uint64_t cpp_island_address, return 0; } - if (!imb_table) { + if (imb_table == NULL) { /* CPP + Island only allowed on systems with IMB tables */ return NFP_ERRNO(EINVAL); } -- 2.29.3