diff mbox series

[net] ch_ktls: Remove the checks for u_ctx pointer

Message ID 20210518055132.9397-1-ayush.sawal@chelsio.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series [net] ch_ktls: Remove the checks for u_ctx pointer | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers warning 3 maintainers not CCed: arnd@arndb.de rohitm@chelsio.com vinay.yadav@chelsio.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 38 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link

Commit Message

Ayush Sawal May 18, 2021, 5:51 a.m. UTC
The u_ctx pointer in case of ch_ktls will always be valid. As u_ctx is
ch_ktls ctx pointer and remains valid until driver is running.

So removing the u_ctx checks.

Fixes: 65e302a9bd57 ("cxgb4/ch_ktls: Clear resources when pf4 device is removed")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
---
 .../chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 20 +++++++++----------
 1 file changed, 9 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
index 59683f79959c..82f847cecf90 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
+++ b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
@@ -371,7 +371,7 @@  static void chcr_ktls_dev_del(struct net_device *netdev,
 		return;
 
 	u_ctx = tx_info->adap->uld[CXGB4_ULD_KTLS].handle;
-	if (u_ctx && u_ctx->detach)
+	if (u_ctx->detach)
 		return;
 	/* clear l2t entry */
 	if (tx_info->l2te)
@@ -443,7 +443,7 @@  static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk,
 	if (tx_ctx->chcr_info)
 		goto out;
 
-	if (u_ctx && u_ctx->detach)
+	if (u_ctx->detach)
 		goto out;
 
 	tx_info = kvzalloc(sizeof(*tx_info), GFP_KERNEL);
@@ -688,15 +688,13 @@  static int chcr_ktls_cpl_act_open_rpl(struct adapter *adap,
 		tls_ctx = tls_get_ctx(tx_info->sk);
 		tx_ctx = chcr_get_ktls_tx_context(tls_ctx);
 		u_ctx = adap->uld[CXGB4_ULD_KTLS].handle;
-		if (u_ctx) {
-			ret = xa_insert_bh(&u_ctx->tid_list, tid, tx_ctx,
-					   GFP_NOWAIT);
-			if (ret < 0) {
-				pr_err("%s: Failed to allocate tid XA entry = %d\n",
-				       __func__, tx_info->tid);
-				tx_info->open_state = CH_KTLS_OPEN_FAILURE;
-				goto out;
-			}
+		ret = xa_insert_bh(&u_ctx->tid_list, tid, tx_ctx,
+				   GFP_NOWAIT);
+		if (ret < 0) {
+			pr_err("%s: Failed to allocate tid XA entry = %d\n",
+			       __func__, tx_info->tid);
+			tx_info->open_state = CH_KTLS_OPEN_FAILURE;
+			goto out;
 		}
 		tx_info->open_state = CH_KTLS_OPEN_SUCCESS;
 	} else {