lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220917123155.1899689-2-yangyingliang@huawei.com>
Date:   Sat, 17 Sep 2022 20:31:55 +0800
From:   Yang Yingliang <yangyingliang@...wei.com>
To:     <alsa-devel@...a-project.org>, <linux-kernel@...r.kernel.org>
CC:     <perex@...ex.cz>, <tiwai@...e.com>
Subject: [PATCH -next 2/2] ALSA: mtpav: Switch to use list_for_each_entry() helper

Use list_for_each_entry() helper instead of list_for_each() and
list_entry() to simplify code a bit. No functional change.

Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
 sound/drivers/mtpav.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c
index f212f233ea61..717577e2a609 100644
--- a/sound/drivers/mtpav.c
+++ b/sound/drivers/mtpav.c
@@ -623,7 +623,6 @@ static int snd_mtpav_get_RAWMIDI(struct mtpav *mcard)
 	int rval;
 	struct snd_rawmidi *rawmidi;
 	struct snd_rawmidi_substream *substream;
-	struct list_head *list;
 
 	if (hwports < 1)
 		hwports = 1;
@@ -640,13 +639,15 @@ static int snd_mtpav_get_RAWMIDI(struct mtpav *mcard)
 	rawmidi = mcard->rmidi;
 	rawmidi->private_data = mcard;
 
-	list_for_each(list, &rawmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) {
-		substream = list_entry(list, struct snd_rawmidi_substream, list);
+	list_for_each_entry(substream,
+			    &rawmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams,
+			    list) {
 		snd_mtpav_set_name(mcard, substream);
 		substream->ops = &snd_mtpav_input;
 	}
-	list_for_each(list, &rawmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) {
-		substream = list_entry(list, struct snd_rawmidi_substream, list);
+	list_for_each_entry(substream,
+			    &rawmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams,
+			    list) {
 		snd_mtpav_set_name(mcard, substream);
 		substream->ops = &snd_mtpav_output;
 		mcard->ports[substream->number].hwport = translate_subdevice_to_hwport(mcard, substream->number);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ