ASoC: mid-x86: Use WARN_ON() instead of BUG_ON()
authorTakashi Iwai <tiwai@suse.de>
Tue, 5 Nov 2013 17:40:01 +0000 (18:40 +0100)
committerMark Brown <broonie@linaro.org>
Thu, 7 Nov 2013 19:55:11 +0000 (19:55 +0000)
BUG_ON() is rather useless for debugging as it leads to panic().
Use WARN_ON() and handle the error cases accordingly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/mid-x86/sst_platform.c

index 392fc0b8f5b8b06c53cf1c324e63127b596b6aac..b6b5eb698d33227af2193196847b64be291e595a 100644 (file)
@@ -40,7 +40,8 @@ static DEFINE_MUTEX(sst_lock);
 
 int sst_register_dsp(struct sst_device *dev)
 {
-       BUG_ON(!dev);
+       if (WARN_ON(!dev))
+               return -EINVAL;
        if (!try_module_get(dev->dev->driver->owner))
                return -ENODEV;
        mutex_lock(&sst_lock);
@@ -59,7 +60,8 @@ EXPORT_SYMBOL_GPL(sst_register_dsp);
 
 int sst_unregister_dsp(struct sst_device *dev)
 {
-       BUG_ON(!dev);
+       if (WARN_ON(!dev))
+               return -EINVAL;
        if (dev != sst)
                return -EINVAL;