From patchwork Mon Jan 30 19:52:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 50449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2367738wrn; Mon, 30 Jan 2023 11:58:50 -0800 (PST) X-Google-Smtp-Source: AK7set/UquJaSImki5zl7JISk1SPBR2CnrL33ctk+3wcglqhIcCvq8tjavatETAgr9sZOaE2mtoC X-Received: by 2002:a17:902:c412:b0:196:82a0:4187 with SMTP id k18-20020a170902c41200b0019682a04187mr6360236plk.36.1675108729805; Mon, 30 Jan 2023 11:58:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675108729; cv=none; d=google.com; s=arc-20160816; b=WFX+EQC7dklQrShQyYjigZ9xBabQi8hZocsMC9nh7e3wIkYNih8W1j4rSLNz95+WAf jafDhiWrsMuEFViFYgrNIc3hsOylRGjRcsVzC+rVNwCYKZ6mfStVkvjyjAGDlUHk+g2Y ZjYJJRGwEh61LUuoGAUkaJBSSFPqJaswliiDHyCJZ0rmFV7ZLq+PYVfHG0mANqjvMTtq GpCkEPsfZSuLdVs60gDgCbvjkQEY0wpi7nJgyi71PZUQwwbpIUfk4kqZkne8bGNl3cr0 K6jnVieDWom9LwY0arj+Vz0s0nSYfmywQ7vSqsBBcR21gitPO54vV6hB5G1sqcu8jH2U pfow== 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=MJLdLYfV0nlkv8oAH+Z9EZhjveMWq9QUWlNjIZBuW48=; b=F+nHwZ81UX0zkKLS383vYe/jN/8SYQ+WHbRWB42Wrfhf9uQyBDwwruvNuf5PYIxQly 5ygp9HP6MkMViSe7uA9evIo/dLEH9UX6dr532fJR7+XJzgcVGfUG5DsxIHuEEDnB98P2 Pt41E+aQeTZ1cImCZmrA/v5D6QDH74AkmFrFnAxWDac/Jc4t+qeeVPXXWuaWIB2VsH0N s9L8oYvaBbMyVxfKgtb2OzK9VASj9/j8/h0hgVL/aVxDJQ8L+dmpRQrz3eayICog1YpV VUX9q0I0K6UgwfDqS7QSnXeOR4mx8183DUUtG7GkjYGiGW9Nopsa3HHDEVWtT4kFODXG mnBA== 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 p3-20020a056a000b4300b0058bb1210a20si3636961pfo.85.2023.01.30.11.58.37; Mon, 30 Jan 2023 11:58:49 -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 S237953AbjA3Txl (ORCPT + 99 others); Mon, 30 Jan 2023 14:53:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237556AbjA3Tx1 (ORCPT ); Mon, 30 Jan 2023 14:53:27 -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 101F54ED3 for ; Mon, 30 Jan 2023 11:53:25 -0800 (PST) Received: from dslb-188-097-040-029.188.097.pools.vodafone-ip.de ([188.97.40.29] 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 1pMaDP-0007S2-VE; Mon, 30 Jan 2023 20:53:20 +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 5/9] staging: r8188eu: use kernel helper to iterate over a list Date: Mon, 30 Jan 2023 20:52:59 +0100 Message-Id: <20230130195303.138941-6-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230130195303.138941-1-martin@kaiser.cx> References: <20230130195303.138941-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?1756478811416255572?= X-GMAIL-MSGID: =?utf-8?q?1756478811416255572?= rtw_free_xmitframe_list iterates over the list of xmit_frames and frees each entry. We can use list_for_each_entry_safe instead of coding this manually. We need the _safe version as the current pxmitframe will be removed from the list by rtw_free_xmitframe. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_xmit.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index 24cf11e7b4bc..c2b1e6f1d358 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -1327,18 +1327,10 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram void rtw_free_xmitframe_list(struct xmit_priv *pxmitpriv, struct list_head *xframe_list) { - struct list_head *plist; - struct xmit_frame *pxmitframe; - - plist = xframe_list->next; - - while (xframe_list != plist) { - pxmitframe = container_of(plist, struct xmit_frame, list); - - plist = plist->next; + struct xmit_frame *pxmitframe, *tmp_xmitframe; + list_for_each_entry_safe(pxmitframe, tmp_xmitframe, xframe_list, list) rtw_free_xmitframe(pxmitpriv, pxmitframe); - } } struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i)