aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ac97/ac97_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ac97/ac97_codec.c')
-rw-r--r--sound/pci/ac97/ac97_codec.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 171559c19b3d..d0023e99bdf9 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1890,8 +1890,8 @@ int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops,
1890 .dev_free = snd_ac97_bus_dev_free, 1890 .dev_free = snd_ac97_bus_dev_free,
1891 }; 1891 };
1892 1892
1893 snd_assert(card != NULL, return -EINVAL); 1893 if (snd_BUG_ON(!card))
1894 snd_assert(rbus != NULL, return -EINVAL); 1894 return -EINVAL;
1895 bus = kzalloc(sizeof(*bus), GFP_KERNEL); 1895 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
1896 if (bus == NULL) 1896 if (bus == NULL)
1897 return -ENOMEM; 1897 return -ENOMEM;
@@ -1906,7 +1906,8 @@ int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops,
1906 snd_ac97_bus_free(bus); 1906 snd_ac97_bus_free(bus);
1907 return err; 1907 return err;
1908 } 1908 }
1909 *rbus = bus; 1909 if (rbus)
1910 *rbus = bus;
1910 return 0; 1911 return 0;
1911} 1912}
1912 1913
@@ -1991,10 +1992,14 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
1991 .dev_disconnect = snd_ac97_dev_disconnect, 1992 .dev_disconnect = snd_ac97_dev_disconnect,
1992 }; 1993 };
1993 1994
1994 snd_assert(rac97 != NULL, return -EINVAL); 1995 if (rac97)
1995 *rac97 = NULL; 1996 *rac97 = NULL;
1996 snd_assert(bus != NULL && template != NULL, return -EINVAL); 1997 if (snd_BUG_ON(!bus || !template))
1997 snd_assert(template->num < 4 && bus->codec[template->num] == NULL, return -EINVAL); 1998 return -EINVAL;
1999 if (snd_BUG_ON(template->num >= 4))
2000 return -EINVAL;
2001 if (bus->codec[template->num])
2002 return -EBUSY;
1998 2003
1999 card = bus->card; 2004 card = bus->card;
2000 ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL); 2005 ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL);