ata: libata-core: get rid of *else* branches in ata_id_n_sectors()
PATCH 1/1 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 <[email protected]>
---
This patch is against the 'for-next' branch of Damien's 'libata.git' repo.
drivers/ata/libata-core.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/ata/libata-core.c +9 -11
@@ -1103,18 +1103,16 @@ static u64 ata_id_n_sectors(const u16 *iif (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)
Quoted 4 lines · Sergey Shtylyov
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 <[email protected]>
Suggested-by Damien Le Moal <[email protected]>
MBR, Sergey
Damien Le Moal
AppliedQuoted 4 lines · Sergey Shtylyov
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 <[email protected]>
Applied to for-5.20. Thanks !
Signature · 2 lines
Damien Le Moal Western Digital Research