From: Tom Yan <[email protected]>

1. Removed a repeated bit masking in ata_mselect_control()
2. Moved `wce`/`d_sense` assignment below the page validity checks
3. Added/Removed empty lines where appropriate

Signed-off-by: Tom Yan <[email protected]>

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index b00521b..06afe63 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3604,7 +3604,6 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
         * The first two bytes of def_cache_mpage are a header, so offsets
         * in mpage are off by 2 compared to buf.  Same for len.
         */
-
        if (len != CACHE_MPAGE_LEN - 2) {
                if (len < CACHE_MPAGE_LEN - 2)
                        *fp = len;
@@ -3613,8 +3612,6 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
                return -EINVAL;
        }
 
-       wce = buf[0] & (1 << 2);
-
        /*
         * Check that read-only bits are not modified.
         */
@@ -3628,6 +3625,8 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
                }
        }
 
+       wce = buf[0] & (1 << 2);
+
        tf->flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
        tf->protocol = ATA_PROT_NODATA;
        tf->nsect = 0;
@@ -3660,7 +3659,6 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
         * The first two bytes of def_control_mpage are a header, so offsets
         * in mpage are off by 2 compared to buf.  Same for len.
         */
-
        if (len != CONTROL_MPAGE_LEN - 2) {
                if (len < CONTROL_MPAGE_LEN - 2)
                        *fp = len;
@@ -3669,8 +3667,6 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
                return -EINVAL;
        }
 
-       d_sense = buf[0] & (1 << 2);
-
        /*
         * Check that read-only bits are not modified.
         */
@@ -3683,7 +3679,10 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
                        return -EINVAL;
                }
        }
-       if (d_sense & (1 << 2))
+
+       d_sense = buf[0] & (1 << 2);
+
+       if (d_sense)
                dev->flags |= ATA_DFLAG_D_SENSE;
        else
                dev->flags &= ~ATA_DFLAG_D_SENSE;
-- 
2.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to