Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3599991yba; Mon, 29 Apr 2019 05:29:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyB3sHwHfD06H9Honwpaa55g6I/eIUuItx0sMQ1ollftwUXbtHXw7vIuaxRlAvvxh3YIlmS X-Received: by 2002:aa7:884b:: with SMTP id k11mr42931376pfo.49.1556540986187; Mon, 29 Apr 2019 05:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556540986; cv=none; d=google.com; s=arc-20160816; b=MZ12f2+KlFDuEyfLIFZlxZgelT4HzH6a2C3SZjF/5qFOYEEFmdhkYCdNn5UpOs4UrD PQFQ1zuwdYLl19FZL8D+VjHMcoFiOEeca80zfBWU16/K9MX6MKSpFJ0s4Xhnrv4c8tuZ rcorvq9rLIrnGhjghwnglO3L7kMbQnDCrF5HOMqjyWdVsHoXxA9DckrRZ64vZXUeR4KM CjMEr1WHuBod1kLNQvzqwTByUOM0m0CoUH9AoFQ/TnV2LQYaneQHh8GvBHTP+an5/RQj +R6Mku6OlDp299+8esFhAMK95i38MnUe2xLJnpSma7zPIZyrSk6DHKAlqhFso5zqzxLz dlew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=EHUSm/sQJ/vHSlbS9dQzX1cgUmbeeqC2YbMJf+gS+9E=; b=konMUKfUkgMfjwUoNtkngHIl+uMsKEQjgyHHSJ98inuG5HskwUnB7bm2m88boQqYxE aWEHsEOegTpy/3uZJmX6DOtrb2B6WzPn6cmG3NCBNvpDy8ItefyogkHCHQ/JWg/Zxav1 fwKkz7poEJr35LmKlvimGOIZk6LdXtyUxr7tyhdJnnd6NnOAPYiroy8d96LSLSQbdUCb +KgyyCH63GEZS2Mt1VU0E6Aah7gH8ZF9XzthMOwOvS5GcYIIEv6AquhmQHRFmcamj0Ru Kema0jKh91BlzbT4xP2jPmaMHlhC2ApRGhSta4B3WahqoffrPzz14pqU8ET2JTuK8Td8 JAiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l20si5397203pfj.71.2019.04.29.05.29.30; Mon, 29 Apr 2019 05:29:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728101AbfD2M1Y (ORCPT + 99 others); Mon, 29 Apr 2019 08:27:24 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:39456 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727956AbfD2M1X (ORCPT ); Mon, 29 Apr 2019 08:27:23 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B11085537030402A0CCD; Mon, 29 Apr 2019 20:27:21 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Mon, 29 Apr 2019 20:27:11 +0800 From: Wei Yongjun To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Orson Zhai , Baolin Wang , Chunyan Zhang CC: Wei Yongjun , , , Subject: [PATCH -next] ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items Date: Mon, 29 Apr 2019 12:37:13 +0000 Message-ID: <20190429123713.64280-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since we will remove items off the list using list_del() we need to use a safe version of the list_for_each_entry() macro aptly named list_for_each_entry_safe(). Fixes: d7bff893e04f ("ASoC: sprd: Add Spreadtrum multi-channel data transfer support") Signed-off-by: Wei Yongjun --- sound/soc/sprd/sprd-mcdt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/sprd/sprd-mcdt.c b/sound/soc/sprd/sprd-mcdt.c index 28f5e649733d..df250f7f2b6f 100644 --- a/sound/soc/sprd/sprd-mcdt.c +++ b/sound/soc/sprd/sprd-mcdt.c @@ -978,12 +978,12 @@ static int sprd_mcdt_probe(struct platform_device *pdev) static int sprd_mcdt_remove(struct platform_device *pdev) { - struct sprd_mcdt_chan *temp; + struct sprd_mcdt_chan *chan, *temp; mutex_lock(&sprd_mcdt_list_mutex); - list_for_each_entry(temp, &sprd_mcdt_chan_list, list) - list_del(&temp->list); + list_for_each_entry_safe(chan, temp, &sprd_mcdt_chan_list, list) + list_del(&chan->list); mutex_unlock(&sprd_mcdt_list_mutex);