Skip to contentSkip to conversation

target/transport: Silence unitialized variable warnings

PATCH New Dan Carpenter 1 participant 1 message Apr 14, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/transport: Silence unitialized variable warnings

The core_scsi3_ua_for_check_condition() can return without initializing these variables. I have initialized them to zero so that it triggers a WARN_ON_ONCE() in that situation.

drivers/target/target_core_transport.c +2 -1
index ab2bf12..851e634 100644
@@ -2884,7 +2884,8 @@ static int translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason)
 	const struct sense_info *si;
 	u8 *buffer = cmd->sense_buffer;
 	int r = (__force int)reason;
-	u8 asc, ascq;
+	u8 asc = 0;
+	u8 ascq = 0;
 	bool desc_format = target_sense_desc_format(cmd->se_dev);
 
 	if (r < ARRAY_SIZE(sense_info_table) && sense_info_table[r].key)