@@ -142,7 +142,7 @@ void ide_write(uint8_t channel, uint8_t reg, uint8_t data) {
142142}
143143
144144uint8_t ide_read (uint8_t channel , uint8_t reg ) {
145- uint8_t result ;
145+ uint8_t result = 0 ;
146146 if (reg > 0x07 && reg < 0x0C )
147147 ide_write (channel , ATA_REG_CONTROL , 0x80 | channels [channel ].nIEN );
148148 if (reg < 0x08 )
@@ -151,8 +151,7 @@ uint8_t ide_read(uint8_t channel, uint8_t reg) {
151151 result = io_in8 (channels [channel ].base + reg - 0x06 );
152152 else if (reg < 0x0E )
153153 result = io_in8 (channels [channel ].ctrl + reg - 0x0A );
154- else if (reg < 0x16 )
155- result = io_in8 (channels [channel ].bmide + reg - 0x0E );
154+ else result = io_in8 (channels [channel ].bmide + reg - 0x0E );
156155 if (reg > 0x07 && reg < 0x0C ) ide_write (channel , ATA_REG_CONTROL , channels [channel ].nIEN );
157156 return result ;
158157}
@@ -181,7 +180,7 @@ uint8_t ide_ata_access(uint8_t direction, uint8_t drive, uint32_t lba, uint8_t n
181180 uint16_t selector , uint64_t edi ) {
182181 uint8_t lba_mode /* 0: CHS, 1:LBA28, 2: LBA48 */ , dma /* 0: No DMA, 1: DMA */ , cmd ;
183182 uint8_t lba_io [6 ];
184- uint32_t channel = ide_devices [drive ].Channel ; // Read the Channel.
183+ uint8_t channel = ide_devices [drive ].Channel ; // Read the Channel.
185184 uint32_t slavebit = ide_devices [drive ].Drive ; // Read the Drive [Master/Slave]
186185 uint32_t bus = channels [channel ].base ; // Bus Base, like 0x1F0 which is also data port.
187186 uint32_t words = 256 ; // Almost every ATA drive has a sector-size of 512-byte.
@@ -276,7 +275,7 @@ uint8_t ide_ata_access(uint8_t direction, uint8_t drive, uint32_t lba, uint8_t n
276275 uint16_t * word_ = (uint16_t * )edi ;
277276 for (i = 0 ; i < numsects ; i ++ ) {
278277 klog ("read %d" , i );
279- if ((err = ide_polling (channel , 1 )) != NULL )
278+ if ((err = ide_polling (channel , 1 )) != 0 )
280279 return err ; // Polling, set error and exit if there is.
281280
282281 klog ("words=%d bus=%d" , words , bus );
0 commit comments