diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2010-05-29 20:44:09 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2010-05-29 20:44:09 +0000 |
commit | acf98d9e7f98ccd5f57ceaed1f6c4874af3dae10 (patch) | |
tree | 0b9c7b08d2ce4bf9f10941df2b81e4d8c56b8fd9 /firmware/storage.c | |
parent | c401eecd26344ad0d4c69c66b8c71c1bb5b9b631 (diff) | |
download | rockbox-acf98d9e7f98ccd5f57ceaed1f6c4874af3dae10.tar.gz rockbox-acf98d9e7f98ccd5f57ceaed1f6c4874af3dae10.zip |
fix broken case handling in storage_present() and storage_removable(). Those were buggy for targets with a hotswappable drive *and* more than one storage driver (i.e. only the D2 was probably affected)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26395 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/storage.c')
-rw-r--r-- | firmware/storage.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/firmware/storage.c b/firmware/storage.c index 1dd315948c..fd8ed60aba 100644 --- a/firmware/storage.c +++ b/firmware/storage.c @@ -581,8 +581,6 @@ void storage_get_info(int drive, struct storage_info *info) #ifdef HAVE_HOTSWAP bool storage_removable(int drive) { - bool ret = false; - int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; @@ -590,37 +588,36 @@ bool storage_removable(int drive) { #if (CONFIG_STORAGE & STORAGE_ATA) case STORAGE_ATA: - ret = ata_removable(ldrive); + return ata_removable(ldrive); #endif #if (CONFIG_STORAGE & STORAGE_MMC) case STORAGE_MMC: - ret = mmc_removable(ldrive); + return mmc_removable(ldrive); #endif #if (CONFIG_STORAGE & STORAGE_SD) case STORAGE_SD: - ret = sd_removable(ldrive); + return sd_removable(ldrive); #endif #if (CONFIG_STORAGE & STORAGE_NAND) case STORAGE_NAND: - ret = false; + return false; #endif #if (CONFIG_STORAGE & STORAGE_RAMDISK) case STORAGE_RAMDISK: - ret = false; + return false; #endif + + default: + return false; } - - return ret; } bool storage_present(int drive) { - bool ret = false; - int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; @@ -628,31 +625,35 @@ bool storage_present(int drive) { #if (CONFIG_STORAGE & STORAGE_ATA) case STORAGE_ATA: - ret = ata_present(ldrive); + return ata_present(ldrive); #endif #if (CONFIG_STORAGE & STORAGE_MMC) case STORAGE_MMC: - ret = mmc_present(ldrive); + return mmc_present(ldrive); #endif #if (CONFIG_STORAGE & STORAGE_SD) case STORAGE_SD: - ret = sd_present(ldrive); + return sd_present(ldrive); + break; #endif #if (CONFIG_STORAGE & STORAGE_NAND) case STORAGE_NAND: - ret = true; + return true; + break; #endif #if (CONFIG_STORAGE & STORAGE_RAMDISK) case STORAGE_RAMDISK: - ret = true; + return true; + break; #endif + + default: + return false; } - - return ret; } #endif |