From patchwork Mon Jan 23 20:53:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 47385 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1811156wrn; Mon, 23 Jan 2023 12:56:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXvCmVZEf2aO403OQ8mZbjpMJoRLm00ybzim5XKVft8M+pAstbEipVYLZIiueyQaoRxsfFtH X-Received: by 2002:a05:6a20:1596:b0:b8:7905:b6c4 with SMTP id h22-20020a056a20159600b000b87905b6c4mr33399968pzj.61.1674507397110; Mon, 23 Jan 2023 12:56:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674507397; cv=none; d=google.com; s=arc-20160816; b=qcMfha2tQ92S4UW7rFQNglc4/8E4pqcAsjhS/sui5wfWhTrfRGavNpgXgeaT1zdT2B 4ln0zrXvobIgCj91D7OhZhjG6Wyk9fxDF8pNGEdCTRf9WDfrYDksCO1nrbC7g5vySGPf EeRSZuhqrAmxuewO3N54ntH6wyBL2fLCZ0+lgXnS8Jl8NxGDoVMCtEmSp9lwelVMcSlv s1BIzVR67XOczTbpRDfziiA93n8Zc4qVMsYrVu5NLw9T7mBxcZzsQ67FSZ2NhnqpNP9a wQr8NbHcTXFKzdQnZHC+qr5pi1cINsG3IvH+rOGoWABas/+b5nvsEcWNhH4lvzu2IOIz SUqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vtezimfmRIuXCTWXgsRYwjBkmFE7xqsyfzFfPJYyr5g=; b=YAdDxmHwWAL92DzgUf+uTH3l4QEpmHHQ0/xXEaNccfxTvfkKgdriGHQ2EIkRxgzY9x T+FAahsdE3ciOcgYE4FMTQLQHl6rw7MA/V7B3WqM7ZvF7qkqxuBijd3q6hc1bdvKHQh7 qGh8tVpDBCfFR590y6hdI+whWpwdwquniFjxcxFBvkfosvoYZ8DkwMCPYDzM45QRBsct JeciENEEz7DTZZCPMaPDeuyd6Q2eb/a/h9LcIFPhFSUJz/INAsy4iihHZu/OphEuZsb6 wxUXAogGzlnxWq2f6pE06GwDOkikqDiuB6FH81a6Nckc1lH7W9LBxDkD1mk6NL717c+6 uAvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e1-20020a17090301c100b001945b3a1db5si351725plh.153.2023.01.23.12.56.24; Mon, 23 Jan 2023 12:56:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232249AbjAWUy2 (ORCPT + 99 others); Mon, 23 Jan 2023 15:54:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231795AbjAWUyN (ORCPT ); Mon, 23 Jan 2023 15:54:13 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA6E525E38 for ; Mon, 23 Jan 2023 12:54:09 -0800 (PST) Received: from ipservice-092-217-089-134.092.217.pools.vodafone-ip.de ([92.217.89.134] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1pK3pM-0000Lk-1E; Mon, 23 Jan 2023 21:54:04 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 11/23] staging: r8188eu: simplify dequeue_one_xmitframe Date: Mon, 23 Jan 2023 21:53:30 +0100 Message-Id: <20230123205342.229589-12-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230123205342.229589-1-martin@kaiser.cx> References: <20230123205342.229589-1-martin@kaiser.cx> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755848268331335296?= X-GMAIL-MSGID: =?utf-8?q?1755848268331335296?= Revert the if condition and exit immediately if the list of xmitframes is empty. Hopefully, this makes the code a little bit simpler. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_xmit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index 334d75214011..96079d9a6c42 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -1358,16 +1358,16 @@ s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitfram static struct xmit_frame *dequeue_one_xmitframe(struct tx_servq *ptxservq, struct __queue *pframe_queue) { struct list_head *xmitframe_plist, *xmitframe_phead; - struct xmit_frame *pxmitframe = NULL; + struct xmit_frame *pxmitframe; xmitframe_phead = get_list_head(pframe_queue); - xmitframe_plist = xmitframe_phead->next; + if (list_empty(xmitframe_phead)) + return NULL; - if (!list_empty(xmitframe_phead)) { - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); - list_del_init(&pxmitframe->list); - ptxservq->qcnt--; - } + xmitframe_plist = xmitframe_phead->next; + pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list); + list_del_init(&pxmitframe->list); + ptxservq->qcnt--; return pxmitframe; }