Message ID | 20191107164848.31837-2-martin.wilck@suse.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] scsi: qla2xxx: initialize fc4_type_priority | expand |
On Thu, 2019-11-07 at 16:49 +0000, Martin Wilck wrote: > From: Martin Wilck <mwilck@suse.com> > > Avoid an uninitialized value being falsely treated as NVMe priority. > > Signed-off-by: Martin Wilck <mwilck@suse.com> > --- > drivers/scsi/qla2xxx/qla_def.h | 6 ++++-- > drivers/scsi/qla2xxx/qla_inline.h | 2 +- > 2 files changed, 5 insertions(+), 3 deletions(-) Tested-by: David Bond <dbond@suse.com>
On 11/7/19 8:49 AM, Martin Wilck wrote:
> Avoid an uninitialized value being falsely treated as NVMe priority.
Although this patch looks fine to me: which uninitialized value are you
referring to and how does this patch make a difference?
Thanks,
Bart.
On 11/7/19 1:26 PM, Bart Van Assche wrote: > On 11/7/19 8:49 AM, Martin Wilck wrote: >> Avoid an uninitialized value being falsely treated as NVMe priority. > > Although this patch looks fine to me: which uninitialized value are you > referring to and how does this patch make a difference? Does your comment refer to ha->fc4_type_priority ? You may want to mention this in the commit message since that variable does not occur in the code touched by this patch. Thanks, Bart.
On Thu, 2019-11-07 at 13:36 -0800, Bart Van Assche wrote: > On 11/7/19 1:26 PM, Bart Van Assche wrote: > > On 11/7/19 8:49 AM, Martin Wilck wrote: > > > Avoid an uninitialized value being falsely treated as NVMe > > > priority. > > > > Although this patch looks fine to me: which uninitialized value are > > you > > referring to and how does this patch make a difference? > > Does your comment refer to ha->fc4_type_priority ? You may want to > mention this in the commit message since that variable does not occur > in > the code touched by this patch. Right. Thanks for pointing that out.
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 721ee7f..86c5155 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2476,8 +2476,10 @@ typedef struct fc_port { u16 n2n_chip_reset; } fc_port_t; -#define FC4_PRIORITY_NVME 0 -#define FC4_PRIORITY_FCP 1 +enum { + FC4_PRIORITY_NVME = 1, + FC4_PRIORITY_FCP = 2, +}; #define QLA_FCPORT_SCAN 1 #define QLA_FCPORT_FOUND 2 diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index d728b17..352aba4 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -317,5 +317,5 @@ qla2xxx_get_fc4_priority(struct scsi_qla_host *vha) ((uint8_t *)vha->hw->nvram)[NVRAM_DUAL_FCP_NVME_FLAG_OFFSET]; - return ((data >> 6) & BIT_0); + return (data >> 6) & BIT_0 ? FC4_PRIORITY_FCP : FC4_PRIORITY_NVME; }