summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorSu Hui <suhui@nfschina.com>2023-06-15 05:17:32 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-11 12:33:37 +0300
commit809af7bb4219bdeef0dbb8b2ed700d6516d13fe9 (patch)
treefcfd406b0a82a2492a58edb143a5566acba9c9fe /sound
parent7200d1e8d872a3c6d81a451dca359bafe49c74c9 (diff)
downloadlinux-809af7bb4219bdeef0dbb8b2ed700d6516d13fe9.tar.xz
ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer
[ Upstream commit 79597c8bf64ca99eab385115743131d260339da5 ] smatch error: sound/pci/ac97/ac97_codec.c:2354 snd_ac97_mixer() error: we previously assumed 'rac97' could be null (see line 2072) remove redundant assignment, return error if rac97 is NULL. Fixes: da3cec35dd3c ("ALSA: Kill snd_assert() in sound/pci/*") Signed-off-by: Su Hui <suhui@nfschina.com> Link: https://lore.kernel.org/r/20230615021732.1972194-1-suhui@nfschina.com Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/ac97/ac97_codec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index d5dfc7349e70..e37eab3ddc73 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -2026,8 +2026,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
.dev_disconnect = snd_ac97_dev_disconnect,
};
- if (rac97)
- *rac97 = NULL;
+ if (!rac97)
+ return -EINVAL;
if (snd_BUG_ON(!bus || !template))
return -EINVAL;
if (snd_BUG_ON(template->num >= 4))