diff options
author | Sergey Shtylyov | 2022-06-10 00:06:54 +0300 |
---|---|---|
committer | Damien Le Moal | 2022-06-14 17:58:57 +0900 |
commit | 5eb8deb4af56b120c152066ff43a0867267b264b (patch) | |
tree | d64c47caef10c2925d2817e92bcfde55a978c028 /drivers/ata | |
parent | 79ad6a561958777d6d8ecfa66e51d09d35ec6450 (diff) |
ata: libata-core: get rid of *else* branches in ata_id_n_sectors()
Using *else* after *return* doesn't make much sense -- getting rid of such
*else* branches reduces the indentation levels and thus reduces # of LoC...
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index e3f1c3da5950..980328a4b896 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -1103,18 +1103,16 @@ static u64 ata_id_n_sectors(const u16 *id) if (ata_id_has_lba(id)) { if (ata_id_has_lba48(id)) return ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); - else - return ata_id_u32(id, ATA_ID_LBA_CAPACITY); - } else { - if (ata_id_current_chs_valid(id)) - return (u32)id[ATA_ID_CUR_CYLS] * - (u32)id[ATA_ID_CUR_HEADS] * - (u32)id[ATA_ID_CUR_SECTORS]; - else - return (u32)id[ATA_ID_CYLS] * - (u32)id[ATA_ID_HEADS] * - (u32)id[ATA_ID_SECTORS]; + + return ata_id_u32(id, ATA_ID_LBA_CAPACITY); } + + if (ata_id_current_chs_valid(id)) + return (u32)id[ATA_ID_CUR_CYLS] * (u32)id[ATA_ID_CUR_HEADS] * + (u32)id[ATA_ID_CUR_SECTORS]; + + return (u32)id[ATA_ID_CYLS] * (u32)id[ATA_ID_HEADS] * + (u32)id[ATA_ID_SECTORS]; } u64 ata_tf_to_lba48(const struct ata_taskfile *tf) |