diff options
author | Alex Auvolat <alex@adnab.me> | 2016-07-14 10:47:53 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2016-07-14 10:47:53 +0200 |
commit | 477911553e0443fcafad5bd96c97314aa2f8d9ea (patch) | |
tree | 3825cba2552c0c4fe9cf64aecf065402db90f39e /src/kernel/dev | |
parent | d09f8a08bdd9477bd463a2de03397ff56b5ce75d (diff) | |
download | kogata-477911553e0443fcafad5bd96c97314aa2f8d9ea.tar.gz kogata-477911553e0443fcafad5bd96c97314aa2f8d9ea.zip |
Integration of scan-build and splint
Diffstat (limited to 'src/kernel/dev')
-rw-r--r-- | src/kernel/dev/pciide.c | 4 | ||||
-rw-r--r-- | src/kernel/dev/vesa.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/kernel/dev/pciide.c b/src/kernel/dev/pciide.c index d63abb4..f45bc44 100644 --- a/src/kernel/dev/pciide.c +++ b/src/kernel/dev/pciide.c @@ -311,7 +311,7 @@ uint8_t ide_ata_access(ide_controller_t *c, int direction, // If (!DMA & LBA48) DO_PIO_EXT; // If (!DMA & LBA28) DO_PIO_LBA; // If (!DMA & !LBA#) DO_PIO_CHS; - uint8_t cmd; + uint8_t cmd = 0; if (lba_mode == 0 && !dma && direction == 0) cmd = ATA_CMD_READ_PIO; if (lba_mode == 1 && !dma && direction == 0) cmd = ATA_CMD_READ_PIO; if (lba_mode == 2 && !dma && direction == 0) cmd = ATA_CMD_READ_PIO_EXT; @@ -324,6 +324,8 @@ uint8_t ide_ata_access(ide_controller_t *c, int direction, if (lba_mode == 0 && dma && direction == 1) cmd = ATA_CMD_WRITE_DMA; if (lba_mode == 1 && dma && direction == 1) cmd = ATA_CMD_WRITE_DMA; if (lba_mode == 2 && dma && direction == 1) cmd = ATA_CMD_WRITE_DMA_EXT; + ASSERT(cmd != 0); + ide_write(c, channel, ATA_REG_COMMAND, cmd); // Send the Command. if (dma) { diff --git a/src/kernel/dev/vesa.c b/src/kernel/dev/vesa.c index f77b230..03418b4 100644 --- a/src/kernel/dev/vesa.c +++ b/src/kernel/dev/vesa.c @@ -281,6 +281,8 @@ void vesa_detect(fs_t *iofs) { uint16_t *last_mode = modes; while (*last_mode != 0xFFFF) last_mode++; + if (last_mode == modes) goto end_detect; + mode_data = (vesa_mode_t*)malloc((last_mode - modes) * sizeof(vesa_mode_t)); if (mode_data == 0) goto end_detect; |