scsi: qla2xxx: Use ARRAY_SIZE() in the definition of QLA_LAST_SPEED
authorBart Van Assche <bvanassche@acm.org>
Thu, 4 Apr 2019 19:44:41 +0000 (12:44 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 9 Apr 2019 02:16:34 +0000 (22:16 -0400)
Make the code easier to read by avoiding to use a hard-coded constant. This
patch does not change any functionality.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_isr.c

index 20f0761b8b870e5d9387646a9bc8824d45e23577..055d313a046152fca3881a3866ff14e61f0dbd85 100644 (file)
@@ -366,7 +366,7 @@ qla2x00_get_link_speed_str(struct qla_hw_data *ha, uint16_t speed)
        static const char *const link_speeds[] = {
                "1", "2", "?", "4", "8", "16", "32", "10"
        };
-#define        QLA_LAST_SPEED  7
+#define        QLA_LAST_SPEED (ARRAY_SIZE(link_speeds) - 1)
 
        if (IS_QLA2100(ha) || IS_QLA2200(ha))
                return link_speeds[0];