summaryrefslogtreecommitdiff
path: root/drivers/staging/most
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2020-06-22 10:48:15 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-25 15:40:28 +0200
commit0ae9e4f22d1c046e53ad2eb0a8a8c3d9e441fd3d (patch)
treed774e09f813ba428be717295ea6db5ee44947277 /drivers/staging/most
parent78aee6516670d1f8f4e74e5982ea8d557f114b2b (diff)
staging: most: cdev: simplify list iteration
This patch uses a less confusing list traversing structure to either return an item of the list that meets the prerequisites or NULL otherwise. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Link: https://lore.kernel.org/r/1592815695-19305-7-git-send-email-christian.gromm@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most')
-rw-r--r--drivers/staging/most/cdev/cdev.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index aa7d7afd7d83..044880760b58 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -66,19 +66,16 @@ static struct comp_channel *get_channel(struct most_interface *iface, int id)
{
struct comp_channel *c, *tmp;
unsigned long flags;
- int found_channel = 0;
spin_lock_irqsave(&ch_list_lock, flags);
list_for_each_entry_safe(c, tmp, &channel_list, list) {
if ((c->iface == iface) && (c->channel_id == id)) {
- found_channel = 1;
- break;
+ spin_unlock_irqrestore(&ch_list_lock, flags);
+ return c;
}
}
spin_unlock_irqrestore(&ch_list_lock, flags);
- if (!found_channel)
- return NULL;
- return c;
+ return NULL;
}
static void stop_channel(struct comp_channel *c)