diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-11-05 12:39:48 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-11-06 05:26:09 -0500 |
commit | ddb146da23cb08851fa418481dd84412f99eec1e (patch) | |
tree | 4b5827ace13bbb8d8ef8f51031931fdc9569c45d /sound/soc/blackfin | |
parent | 5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52 (diff) |
ASoC: blackfin: Use WARN_ON() instead of BUG_ON()
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>
Diffstat (limited to 'sound/soc/blackfin')
-rw-r--r-- | sound/soc/blackfin/bf5xx-sport.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/sound/soc/blackfin/bf5xx-sport.c b/sound/soc/blackfin/bf5xx-sport.c index 695351241db8..9dfa1241ea66 100644 --- a/sound/soc/blackfin/bf5xx-sport.c +++ b/sound/soc/blackfin/bf5xx-sport.c | |||
@@ -179,8 +179,9 @@ static inline int sport_hook_rx_dummy(struct sport_device *sport) | |||
179 | struct dmasg *desc, temp_desc; | 179 | struct dmasg *desc, temp_desc; |
180 | unsigned long flags; | 180 | unsigned long flags; |
181 | 181 | ||
182 | BUG_ON(sport->dummy_rx_desc == NULL); | 182 | if (WARN_ON(!sport->dummy_rx_desc) || |
183 | BUG_ON(sport->curr_rx_desc == sport->dummy_rx_desc); | 183 | WARN_ON(sport->curr_rx_desc == sport->dummy_rx_desc)) |
184 | return -EINVAL; | ||
184 | 185 | ||
185 | /* Maybe the dummy buffer descriptor ring is damaged */ | 186 | /* Maybe the dummy buffer descriptor ring is damaged */ |
186 | sport->dummy_rx_desc->next_desc_addr = sport->dummy_rx_desc + 1; | 187 | sport->dummy_rx_desc->next_desc_addr = sport->dummy_rx_desc + 1; |
@@ -250,8 +251,9 @@ int sport_rx_start(struct sport_device *sport) | |||
250 | return -EBUSY; | 251 | return -EBUSY; |
251 | if (sport->tx_run) { | 252 | if (sport->tx_run) { |
252 | /* tx is running, rx is not running */ | 253 | /* tx is running, rx is not running */ |
253 | BUG_ON(sport->dma_rx_desc == NULL); | 254 | if (WARN_ON(!sport->dma_rx_desc) || |
254 | BUG_ON(sport->curr_rx_desc != sport->dummy_rx_desc); | 255 | WARN_ON(sport->curr_rx_desc != sport->dummy_rx_desc)) |
256 | return -EINVAL; | ||
255 | local_irq_save(flags); | 257 | local_irq_save(flags); |
256 | while ((get_dma_curr_desc_ptr(sport->dma_rx_chan) - | 258 | while ((get_dma_curr_desc_ptr(sport->dma_rx_chan) - |
257 | sizeof(struct dmasg)) != sport->dummy_rx_desc) | 259 | sizeof(struct dmasg)) != sport->dummy_rx_desc) |
@@ -298,8 +300,9 @@ static inline int sport_hook_tx_dummy(struct sport_device *sport) | |||
298 | struct dmasg *desc, temp_desc; | 300 | struct dmasg *desc, temp_desc; |
299 | unsigned long flags; | 301 | unsigned long flags; |
300 | 302 | ||
301 | BUG_ON(sport->dummy_tx_desc == NULL); | 303 | if (WARN_ON(!sport->dummy_tx_desc) || |
302 | BUG_ON(sport->curr_tx_desc == sport->dummy_tx_desc); | 304 | WARN_ON(sport->curr_tx_desc == sport->dummy_tx_desc)) |
305 | return -EINVAL; | ||
303 | 306 | ||
304 | sport->dummy_tx_desc->next_desc_addr = sport->dummy_tx_desc + 1; | 307 | sport->dummy_tx_desc->next_desc_addr = sport->dummy_tx_desc + 1; |
305 | 308 | ||
@@ -331,8 +334,9 @@ int sport_tx_start(struct sport_device *sport) | |||
331 | if (sport->tx_run) | 334 | if (sport->tx_run) |
332 | return -EBUSY; | 335 | return -EBUSY; |
333 | if (sport->rx_run) { | 336 | if (sport->rx_run) { |
334 | BUG_ON(sport->dma_tx_desc == NULL); | 337 | if (WARN_ON(!sport->dma_tx_desc) || |
335 | BUG_ON(sport->curr_tx_desc != sport->dummy_tx_desc); | 338 | WARN_ON(sport->curr_tx_desc != sport->dummy_tx_desc)) |
339 | return -EINVAL; | ||
336 | /* Hook the normal buffer descriptor */ | 340 | /* Hook the normal buffer descriptor */ |
337 | local_irq_save(flags); | 341 | local_irq_save(flags); |
338 | while ((get_dma_curr_desc_ptr(sport->dma_tx_chan) - | 342 | while ((get_dma_curr_desc_ptr(sport->dma_tx_chan) - |
@@ -767,7 +771,8 @@ static irqreturn_t err_handler(int irq, void *dev_id) | |||
767 | int sport_set_rx_callback(struct sport_device *sport, | 771 | int sport_set_rx_callback(struct sport_device *sport, |
768 | void (*rx_callback)(void *), void *rx_data) | 772 | void (*rx_callback)(void *), void *rx_data) |
769 | { | 773 | { |
770 | BUG_ON(rx_callback == NULL); | 774 | if (WARN_ON(!rx_callback)) |
775 | return -EINVAL; | ||
771 | sport->rx_callback = rx_callback; | 776 | sport->rx_callback = rx_callback; |
772 | sport->rx_data = rx_data; | 777 | sport->rx_data = rx_data; |
773 | 778 | ||
@@ -778,7 +783,8 @@ EXPORT_SYMBOL(sport_set_rx_callback); | |||
778 | int sport_set_tx_callback(struct sport_device *sport, | 783 | int sport_set_tx_callback(struct sport_device *sport, |
779 | void (*tx_callback)(void *), void *tx_data) | 784 | void (*tx_callback)(void *), void *tx_data) |
780 | { | 785 | { |
781 | BUG_ON(tx_callback == NULL); | 786 | if (WARN_ON(!tx_callback)) |
787 | return -EINVAL; | ||
782 | sport->tx_callback = tx_callback; | 788 | sport->tx_callback = tx_callback; |
783 | sport->tx_data = tx_data; | 789 | sport->tx_data = tx_data; |
784 | 790 | ||
@@ -789,7 +795,8 @@ EXPORT_SYMBOL(sport_set_tx_callback); | |||
789 | int sport_set_err_callback(struct sport_device *sport, | 795 | int sport_set_err_callback(struct sport_device *sport, |
790 | void (*err_callback)(void *), void *err_data) | 796 | void (*err_callback)(void *), void *err_data) |
791 | { | 797 | { |
792 | BUG_ON(err_callback == NULL); | 798 | if (WARN_ON(!err_callback)) |
799 | return -EINVAL; | ||
793 | sport->err_callback = err_callback; | 800 | sport->err_callback = err_callback; |
794 | sport->err_data = err_data; | 801 | sport->err_data = err_data; |
795 | 802 | ||
@@ -856,7 +863,8 @@ struct sport_device *sport_init(struct platform_device *pdev, | |||
856 | 863 | ||
857 | param.wdsize = wdsize; | 864 | param.wdsize = wdsize; |
858 | param.dummy_count = dummy_count; | 865 | param.dummy_count = dummy_count; |
859 | BUG_ON(param.wdsize == 0 || param.dummy_count == 0); | 866 | if (WARN_ON(param.wdsize == 0 || param.dummy_count == 0)) |
867 | return NULL; | ||
860 | 868 | ||
861 | ret = sport_config_pdev(pdev, ¶m); | 869 | ret = sport_config_pdev(pdev, ¶m); |
862 | if (ret) | 870 | if (ret) |