]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: saa7134: fix incorrect use to determine if list is empty
authorJakob Koschel <jakobkoschel@gmail.com>
Mon, 28 Feb 2022 14:26:26 +0000 (15:26 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:57:20 +0000 (11:57 +0200)
BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 9f1f4b642451d35667a4dc6a9c0a89d954b530a3 ]

'dev' will *always* be set by list_for_each_entry().
It is incorrect to assume that the iterator value will be NULL if the
list is empty.

Instead of checking the pointer it should be checked if
the list is empty.

Fixes: 79dd0c69f05f ("V4L: 925: saa7134 alsa is now a standalone module")
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit a8523efdc9463bd1f2c5a85d3ddc49b096e58739)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/media/pci/saa7134/saa7134-alsa.c

index fb24d2ed3621b3945450e1ff6195deb08506bf32..d3cde05a6ebab80027cb5722c9d3eccb836022a6 100644 (file)
@@ -1214,7 +1214,7 @@ static int alsa_device_exit(struct saa7134_dev *dev)
 
 static int saa7134_alsa_init(void)
 {
-       struct saa7134_dev *dev = NULL;
+       struct saa7134_dev *dev;
 
        saa7134_dmasound_init = alsa_device_init;
        saa7134_dmasound_exit = alsa_device_exit;
@@ -1229,7 +1229,7 @@ static int saa7134_alsa_init(void)
                        alsa_device_init(dev);
        }
 
-       if (dev == NULL)
+       if (list_empty(&saa7134_devlist))
                pr_info("saa7134 ALSA: no saa7134 cards found\n");
 
        return 0;