Fixed some flawed defensive programming in audio drivers.
This commit is contained in:
parent
32ad26e698
commit
3a892d2312
2 changed files with 11 additions and 9 deletions
|
@ -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);
|
||||
|
@ -393,6 +393,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;
|
||||
|
@ -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));
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue