On 5/18/23 00:58, Nilesh Javali wrote:
+ port_dstate_str_sz = sizeof(port_dstate_str)/sizeof(char *);
Please use ARRAY_SIZE() instead of open-coding it.
@@ -121,7 +123,8 @@ qla2x00_set_fcport_disc_state(fc_port_t *fcport, int state) old_val, (old_val << shiftbits) | state)) { ql_dbg(ql_dbg_disc, fcport->vha, 0x2134, "FCPort %8phC disc_state transition: %s to %s - portid=%06x.\n", - fcport->port_name, port_dstate_str[old_val & mask], + fcport->port_name, ((old_val & mask) < port_dstate_str_sz) ? + port_dstate_str[old_val & mask] : "Unknown", port_dstate_str[state], fcport->d_id.b24);
Please do not introduce more parentheses than necessary. The outer parentheses can be removed from the ((old_val & mask) < port_dstate_str_sz) expression without reducing readability.
Thanks, Bart.