Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3220840pxp; Tue, 8 Mar 2022 09:50:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2QDGb1InRPPnWXXUTEqyQDOTKY+AoemWiT/jmIFnMOKEQrzlZjQYVfla+ooBMr++PsO8X X-Received: by 2002:a05:6402:50d2:b0:413:1cd8:e08e with SMTP id h18-20020a05640250d200b004131cd8e08emr17457723edb.276.1646761855847; Tue, 08 Mar 2022 09:50:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646761855; cv=none; d=google.com; s=arc-20160816; b=rlrZcGqICER4gtBa2dFLT1WWT5XLjGxYGbCjS+POqoeFYL+nZGXAjun8LQqzlzJkwG Fz85UxZQKhZ/OuvodjHK2Up8ZoDYSKmQfVJugVz04sanuLk6HXzql27zsy4CJfkpHMxl 46uSXd+T/D6ZoNrOfQReINR8WzIhCZrHBP5OEqYO1FswsgoR7Z8h4RsyMskjCQkl0Vav yMl/21gviakxdPq0Scr1N40vAiesZ5n3bhf9+kf5fXAYZND6LxBWQIdIfM4W0xNzFdoO 32mNnIoetXBW4iAKc1+FoYoyWdNJ3QfaVnLUCAjxd1kOX252/Cq4aQ3Z0QsnQm4+hNnm hFBQ== 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 :dkim-signature; bh=aqxR4IBXZYNnThtWgqyRIE5yTni2priLEgPy6w83o+Q=; b=lOxTG3kJuBmQRZuwwbrTlQiluO87Fi9HsL8dLb2lt7sF2ARF/idclPVaLqlhjZKmjm lMWlpDF/+QIhbj/rrDTxkQQIHujSz4WlySl1GOJmkToWvn/3orplY36bFb/Wnvh172nY 2gFcV39uxKuga9q270hq6+d7KElQxLSBbDVRLVaLU1UwDFe9Q0QBB0FLS73/DJyu5CkX BFvCCulTGbeU2Rx3cO1s3Xg2oqE7yFUIs/HvRHdv2wdbfVdm8NOe+jSTWj34V1lp13kn O84BF803BgY2jN1Zm7fupIOx9+wfAZfMCJsJLxG/aOfeHx49LmYBFaNBzaZGnSuB6x7e oKpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kgTAP8XG; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l15-20020a1709061c4f00b006d03c19857fsi9668613ejg.725.2022.03.08.09.50.29; Tue, 08 Mar 2022 09:50:55 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kgTAP8XG; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349161AbiCHRWl (ORCPT + 99 others); Tue, 8 Mar 2022 12:22:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348982AbiCHRUw (ORCPT ); Tue, 8 Mar 2022 12:20:52 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D71B54684; Tue, 8 Mar 2022 09:19:43 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id hw13so40608497ejc.9; Tue, 08 Mar 2022 09:19:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aqxR4IBXZYNnThtWgqyRIE5yTni2priLEgPy6w83o+Q=; b=kgTAP8XGpVlUPOF/8Z1AY41u1JN3iLbKcygsYP+oBsccD1GWF+nAWpghgMyp72H+Qj L1y7kTy86rEUTIK2dNmSSFN72ROpe1dz8CaETW1pnHrZoVy1fShKLMGoRpWR1EylKUwd z5GaJzt8eGncFkPGiVdEaYegad+cPaKy842xY9ILXR81ZlU7w4U8+R93HfiduKFTEylV FdylLD9bjZURw96QJo6jao6VG2uLtmK2OakXe6URFFqCWnbG/ps4PYJfyYjtg1VE1Pht 7gpoFEi2mm5Fhmnxt0WuyM2l3yht46dRtZZtGZukOpAEY495gcQgCo6LGhMrfVNTH+8U rHNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aqxR4IBXZYNnThtWgqyRIE5yTni2priLEgPy6w83o+Q=; b=DLn05XSWmJ98PP5g8FanUH41ysvbfG+qoiaQbgQRRLZsqt3GZj9PZbV2nPDF1qErrF fMBw+75famDQn4ogVl5ikYvCvk0jSwI545paLNPTgOK919L5cT8tQSnOtUO+5WijPlbY tmM1+OQq8xoN9/uCYtCLzuCACMBtycpdmHAAjeVj+0M3VgPlm8OexxjrM6ZIcBqJ8eAr /W7g80W2w/SqmCjpm1XMOkHHjSQD8BZcAh7c/H9iglBC739zoAQHrYTrsVnkLqzM7o9w 7YFMws74sXmVfZGffZ1Ts0I7+PolbLP6XvnsAU3ean9vKOAdzxHC9WwdlKRIhOLiTWwy 5jhQ== X-Gm-Message-State: AOAM5334BC8LEUYzkyoYFoxgChcc7Ox6naG9Qr2vwjuHsLieRQeEe9uv Ue76C+nhx2MpvpgRV/Xf95k= X-Received: by 2002:a17:907:6d0e:b0:6d7:c85:5bf5 with SMTP id sa14-20020a1709076d0e00b006d70c855bf5mr14214634ejc.31.1646759980757; Tue, 08 Mar 2022 09:19:40 -0800 (PST) Received: from localhost.localdomain (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.googlemail.com with ESMTPSA id rv11-20020a17090710cb00b006d5c0cd5e0dsm6085044ejb.82.2022.03.08.09.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 09:19:40 -0800 (PST) From: Jakob Koschel To: Greg Kroah-Hartman Cc: Jakob Koschel , linux-kernel@vger.kernel.org, Linus Torvalds , Felipe Balbi , Joel Stanley , Andrew Jeffery , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Cristian Birsan , Al Cooper , Li Yang , Vladimir Zapolskiy , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , Michal Simek , linux-usb@vger.kernel.org (open list:USB GADGET/PERIPHERAL SUBSYSTEM), Mike Rapoport , "Brian Johannesmeyer" , Cristiano Giuffrida , "Bos, H.J." Subject: [PATCH v2 26/26] usb: gadget: udc: s3c2410: remove usage of list iterator past the loop body Date: Tue, 8 Mar 2022 18:18:18 +0100 Message-Id: <20220308171818.384491-27-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308171818.384491-1-jakobkoschel@gmail.com> References: <20220308171818.384491-1-jakobkoschel@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body. To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable [1]. Link: https://lore.kernel.org/all/YhdfEIwI4EdtHdym@kroah.com/ Signed-off-by: Jakob Koschel --- drivers/usb/gadget/udc/s3c2410_udc.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c index e3931da24277..c6625aeb7bca 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.c +++ b/drivers/usb/gadget/udc/s3c2410_udc.c @@ -1265,7 +1265,7 @@ static int s3c2410_udc_dequeue(struct usb_ep *_ep, struct usb_request *_req) struct s3c2410_ep *ep = to_s3c2410_ep(_ep); int retval = -EINVAL; unsigned long flags; - struct s3c2410_request *req = NULL; + struct s3c2410_request *req = NULL, *iter; dprintk(DEBUG_VERBOSE, "%s(%p,%p)\n", __func__, _ep, _req); @@ -1277,13 +1277,14 @@ static int s3c2410_udc_dequeue(struct usb_ep *_ep, struct usb_request *_req) local_irq_save(flags); - list_for_each_entry(req, &ep->queue, queue) { - if (&req->req == _req) { - list_del_init(&req->queue); - _req->status = -ECONNRESET; - retval = 0; - break; - } + list_for_each_entry(iter, &ep->queue, queue) { + if (&iter->req != _req) + continue; + list_del_init(&iter->queue); + _req->status = -ECONNRESET; + req = iter; + retval = 0; + break; } if (retval == 0) { -- 2.25.1