ata: pata_ali: remove redundant return statement
Subsystems (2)
PATCH 1/1 ata: pata_ali: remove redundant return statement
A return statement is unnecessarily complicated, currently value in variable mask is bitwise-masked and the variable is being updated and then returned. Just updating the mask is all that is required as the following statement is a return.
--- drivers/ata/pata_ali.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_ali.c +1 -1
@@ -123,7 +123,7 @@ static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask) mask &= ~(ATA_MASK_MWDMA |ATA_MASK_UDMA );ata_id_c_string (adev->id, model_num,ATA_ID_PROD ,sizeof (model_num));if (strstr (model_num,"WDC" )) -return mask &= ~ATA_MASK_UDMA ; + mask &= ~ATA_MASK_UDMA ;return mask; }
Signature · 1 line
2.33.1
Quoted 15 lines · Colin Ian King
A return statement is unnecessarily complicated, currently value in variable mask is bitwise-masked and the variable is being updated and then returned. Just updating the mask is all that is required as the following statement is a return.
Signed-off-by Colin Ian King <[email protected]>--- drivers/ata/pata_ali.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/ata/pata_ali.c +0
-0
drivers/ata/pata_ali.c static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask) · line 126
Quoted 4 lines
drivers/ata/pata_ali.c +0
-1@@ -123,7 +123,7 @@ static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask) mask &= ~(ATA_MASK_MWDMA |ATA_MASK_UDMA );ata_id_c_string (adev->id, model_num,ATA_ID_PROD ,sizeof (model_num));if (strstr (model_num,"WDC" )) -return mask &= ~ATA_MASK_UDMA ;
Yeah, not to mention that is really ugly as the return should really have been:
return mask & ~ATA_MASK_UDMA;
drivers/ata/pata_ali.c static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask) · line 129
Quoted 4 lines
drivers/ata/pata_ali.c +1
-0+ mask &= ~ATA_MASK_UDMA ;return mask; }
Will queue this up.
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 24 lines · Damien Le Moal
Quoted 15 lines · Colin Ian King
A return statement is unnecessarily complicated, currently value in variable mask is bitwise-masked and the variable is being updated and then returned. Just updating the mask is all that is required as the following statement is a return.
Signed-off-by Colin Ian King <[email protected]>--- drivers/ata/pata_ali.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/ata/pata_ali.c +0
-0drivers/ata/pata_ali.c static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask) · line 126
Quoted 4 lines
drivers/ata/pata_ali.c +0
-1@@ -123,7 +123,7 @@ static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask) mask &= ~(ATA_MASK_MWDMA |ATA_MASK_UDMA );ata_id_c_string (adev->id, model_num,ATA_ID_PROD ,sizeof (model_num));if (strstr (model_num,"WDC" )) -return mask &= ~ATA_MASK_UDMA ;Yeah, not to mention that is really ugly as the return should really have been:
Quoted 1 line
return mask & ~ATA_MASK_UDMA;
Yep, I did think of that as the original intention, but two return statements one after the other was equally as ugly. It was a 50/50 choice of what was perceived as the better fix :-)
Quoted 8 lines
drivers/ata/pata_ali.c static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask) · line 129
Quoted 5 lines
drivers/ata/pata_ali.c +1
-0+ mask &= ~ATA_MASK_UDMA ;return mask; }Will queue this up.
Thank you.