aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/vx/vx_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/drivers/vx/vx_core.c')
-rw-r--r--sound/drivers/vx/vx_core.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c
index 585af2eb1438..473b07f6ae85 100644
--- a/sound/drivers/vx/vx_core.c
+++ b/sound/drivers/vx/vx_core.c
@@ -205,7 +205,8 @@ static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh)
205 205
206 if (size < 1) 206 if (size < 1)
207 return 0; 207 return 0;
208 snd_assert(size <= SIZE_MAX_STATUS, return -EINVAL); 208 if (snd_BUG_ON(size > SIZE_MAX_STATUS))
209 return -EINVAL;
209 210
210 for (i = 1; i <= size; i++) { 211 for (i = 1; i <= size; i++) {
211 /* trigger an irq MESS_WRITE_NEXT */ 212 /* trigger an irq MESS_WRITE_NEXT */
@@ -425,13 +426,16 @@ int snd_vx_load_boot_image(struct vx_core *chip, const struct firmware *boot)
425 int no_fillup = vx_has_new_dsp(chip); 426 int no_fillup = vx_has_new_dsp(chip);
426 427
427 /* check the length of boot image */ 428 /* check the length of boot image */
428 snd_assert(boot->size > 0, return -EINVAL); 429 if (boot->size <= 0)
429 snd_assert(boot->size % 3 == 0, return -EINVAL); 430 return -EINVAL;
431 if (boot->size % 3)
432 return -EINVAL;
430#if 0 433#if 0
431 { 434 {
432 /* more strict check */ 435 /* more strict check */
433 unsigned int c = ((u32)boot->data[0] << 16) | ((u32)boot->data[1] << 8) | boot->data[2]; 436 unsigned int c = ((u32)boot->data[0] << 16) | ((u32)boot->data[1] << 8) | boot->data[2];
434 snd_assert(boot->size == (c + 2) * 3, return -EINVAL); 437 if (boot->size != (c + 2) * 3)
438 return -EINVAL;
435 } 439 }
436#endif 440#endif
437 441
@@ -554,7 +558,8 @@ EXPORT_SYMBOL(snd_vx_irq_handler);
554 */ 558 */
555static void vx_reset_board(struct vx_core *chip, int cold_reset) 559static void vx_reset_board(struct vx_core *chip, int cold_reset)
556{ 560{
557 snd_assert(chip->ops->reset_board, return); 561 if (snd_BUG_ON(!chip->ops->reset_board))
562 return;
558 563
559 /* current source, later sync'ed with target */ 564 /* current source, later sync'ed with target */
560 chip->audio_source = VX_AUDIO_SRC_LINE; 565 chip->audio_source = VX_AUDIO_SRC_LINE;
@@ -673,7 +678,8 @@ int snd_vx_dsp_load(struct vx_core *chip, const struct firmware *dsp)
673 unsigned int csum = 0; 678 unsigned int csum = 0;
674 const unsigned char *image, *cptr; 679 const unsigned char *image, *cptr;
675 680
676 snd_assert(dsp->size % 3 == 0, return -EINVAL); 681 if (dsp->size % 3)
682 return -EINVAL;
677 683
678 vx_toggle_dac_mute(chip, 1); 684 vx_toggle_dac_mute(chip, 1);
679 685
@@ -775,7 +781,8 @@ struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw,
775{ 781{
776 struct vx_core *chip; 782 struct vx_core *chip;
777 783
778 snd_assert(card && hw && ops, return NULL); 784 if (snd_BUG_ON(!card || !hw || !ops))
785 return NULL;
779 786
780 chip = kzalloc(sizeof(*chip) + extra_size, GFP_KERNEL); 787 chip = kzalloc(sizeof(*chip) + extra_size, GFP_KERNEL);
781 if (! chip) { 788 if (! chip) {