ASoC: davinci: Kill BUG_ON() usage
authorTakashi Iwai <tiwai@suse.de>
Thu, 7 Sep 2017 08:59:17 +0000 (10:59 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 20 Sep 2017 11:45:36 +0000 (12:45 +0100)
Don't use BUG_ON() for a non-critical sanity check on production
systems.  This patch replaces with a softer WARN_ON() and an error
path.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/davinci/davinci-mcasp.c

index 23b0da7..40be08c 100644 (file)
@@ -1721,7 +1721,8 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp)
                                PTR_ERR(chan));
                return PTR_ERR(chan);
        }
-       BUG_ON(!chan->device || !chan->device->dev);
+       if (WARN_ON(!chan->device || !chan->device->dev))
+               return -EINVAL;
 
        if (chan->device->dev->of_node)
                ret = of_property_read_string(chan->device->dev->of_node,