From: Kees van Reeuwijk Date: Mon, 18 Jan 2010 21:37:24 +0000 (+0000) Subject: Fixed some flawed defensive programming in audio drivers. X-Git-Tag: v3.1.6~70 X-Git-Url: http://zhaoyanbai.com/repos/man.nsec3hash.html?a=commitdiff_plain;h=3a892d23128d1148cdf23721999325302a6a094f;p=minix.git Fixed some flawed defensive programming in audio drivers. --- diff --git a/drivers/audio/es1370/es1370.c b/drivers/audio/es1370/es1370.c index 1c3196d67..7f4679acd 100644 --- a/drivers/audio/es1370/es1370.c +++ b/drivers/audio/es1370/es1370.c @@ -353,11 +353,11 @@ int drv_set_dma(u32_t dma, u32_t length, int chan) { case DAC1_CHAN: page = DAC_MEM_PAGE; frame_count_reg = DAC1_BUFFER_SIZE; dma_add_reg = DAC1_PCI_ADDRESS; - break;; + break; case DAC2_CHAN: page = DAC_MEM_PAGE; frame_count_reg = DAC2_BUFFER_SIZE; dma_add_reg = DAC2_PCI_ADDRESS; - break;; + break; default: return EIO; } pci_outb(reg(MEM_PAGE), page); @@ -390,9 +390,10 @@ int drv_int(int sub_dev) { /* return status of interrupt bit of specified channel*/ switch (sub_dev) { - case DAC1_CHAN: bit = DAC1;break; - case DAC2_CHAN: bit = DAC2;break; - case ADC1_CHAN: bit = ADC;break; + case DAC1_CHAN: bit = DAC1; break; + case DAC2_CHAN: bit = DAC2; break; + case ADC1_CHAN: bit = ADC; break; + default: return EINVAL; } int_status = pci_inl(reg(INTERRUPT_STATUS)) & bit; @@ -408,7 +409,7 @@ int drv_reenable_int(int chan) { case ADC1_CHAN: int_en_bit = R1_INT_EN; break; case DAC1_CHAN: int_en_bit = P1_INTR_EN; break; case DAC2_CHAN: int_en_bit = P2_INTR_EN; break; - default: EINVAL; + default: return EINVAL; } /* clear and reenable an interrupt */ @@ -591,7 +592,7 @@ PRIVATE int disable_int(int chan) { case ADC1_CHAN: int_en_bit = R1_INT_EN; break; case DAC1_CHAN: int_en_bit = P1_INTR_EN; break; case DAC2_CHAN: int_en_bit = P2_INTR_EN; break; - default: EINVAL; + default: return EINVAL; } /* clear the interrupt */ ser_interface = pci_inw(reg(SERIAL_INTERFACE_CTRL)); diff --git a/drivers/audio/es1371/es1371.c b/drivers/audio/es1371/es1371.c index be1715782..e91a09a8c 100644 --- a/drivers/audio/es1371/es1371.c +++ b/drivers/audio/es1371/es1371.c @@ -395,6 +395,7 @@ int drv_int(int sub_dev) { case DAC1_CHAN: bit = DAC1;break; case DAC2_CHAN: bit = DAC2;break; case ADC1_CHAN: bit = ADC;break; + default: return EINVAL; } int_status = pci_inl(reg(INTERRUPT_STATUS)) & bit; @@ -410,7 +411,7 @@ int drv_reenable_int(int chan) { case ADC1_CHAN: int_en_bit = R1_INT_EN; break; case DAC1_CHAN: int_en_bit = P1_INTR_EN; break; case DAC2_CHAN: int_en_bit = P2_INTR_EN; break; - default: EINVAL; + default: return EINVAL; } /* clear and reenable an interrupt */ @@ -594,7 +595,7 @@ PRIVATE int disable_int(int chan) { case ADC1_CHAN: int_en_bit = R1_INT_EN; break; case DAC1_CHAN: int_en_bit = P1_INTR_EN; break; case DAC2_CHAN: int_en_bit = P2_INTR_EN; break; - default: EINVAL; + default: return EINVAL; } /* clear the interrupt */ ser_interface = pci_inw(reg(SERIAL_INTERFACE_CTRL));