On 2/8/17, 10:48 AM, "Bart Van Assche" <Bart.VanAssche@xxxxxxxxxxx> wrote: >On Fri, 2017-02-03 at 14:40 -0800, Himanshu Madhani wrote: >> diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c >> index db6bd92..4225256 100644 >> --- a/drivers/scsi/qla2xxx/qla_mbx.c >> +++ b/drivers/scsi/qla2xxx/qla_mbx.c >> @@ -10,6 +10,29 @@ >> #include <linux/delay.h> >> #include <linux/gfp.h> >> >> +static struct mb_cmd_name { >> + uint16_t cmd; >> + char *str; >> +} mb_str[] = { >> + {0xffff, "unknown"}, >> + {MBC_GET_PORT_DATABASE, "GPDB"}, >> + {MBC_GET_ID_LIST, "GIDList"}, >> + {MBC_GET_LINK_PRIV_STATS, "Stats"}, >> +}; >> + >> +static char *mb_to_str(uint16_t cmd) >> +{ >> + int i; >> + struct mb_cmd_name *e; >> + >> + for (i = 0; i < ARRAY_SIZE(mb_str); i++) { >> + e = mb_str + i; >> + if (cmd == e->cmd) >> + return e->str; >> + } >> + return mb_str[0].str; /* unknown */ >> +} > >Please use const char * instead of char * in the struct definition and for >the mb_to_str() function return type. Please also leave out the element with >index 0xffff from the mb_str[] array and make mb_to_str() return "unknown" >instead of mb_str[0].str if lookup fails. Will update patch and resend. > >Bart. >Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer: > >This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system. >