From 6c298568e91a3a066f08739fd505ff084516db06 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 25 Jul 2020 14:19:14 +0000 Subject: [PATCH] qla2x00t-32gbit: Initialize 'n' before using it The following code: qla82xx_rom_fast_read(ha, 0, &n) only initializes 'n' if it succeeds. Since 'n' may be reported in a debug message even if no ROM reads succeeded, initialize 'n' to zero. This patch fixes the following sparse warning: qla_nx.c:1218: qla82xx_pinit_from_rom() error: uninitialized symbol 'n'. Link: https://lore.kernel.org/r/20200629225454.22863-5-bvanassche@acm.org Cc: Nilesh Javali Cc: Quinn Tran Cc: Himanshu Madhani Cc: Martin Wilck Cc: Roman Bolshakov Reviewed-by: Daniel Wagner Reviewed-by: Shyam Sundar Reviewed-by: Himanshu Madhani Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen See also commit 67668b5b13c7ba12f212d4b9067e54354ce5360b upstream. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9065 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_nx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/qla2x00t-32gbit/qla_nx.c b/qla2x00t-32gbit/qla_nx.c index 10844a1cf..3c8f5267a 100644 --- a/qla2x00t-32gbit/qla_nx.c +++ b/qla2x00t-32gbit/qla_nx.c @@ -1215,6 +1215,7 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha) * Offset 4: Offset and number of addr/value pairs * that present in CRB initialize sequence */ + n = 0; if (qla82xx_rom_fast_read(ha, 0, &n) != 0 || n != 0xcafecafeUL || qla82xx_rom_fast_read(ha, 4, &n) != 0) { ql_log(ql_log_fatal, vha, 0x006e,