Commit 344f0f82 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: firewire-lib: Fix uninitialized variable err issue

The check of error is just done for the case that CIP header is available.

This commit moves auto variable into the branch to process CIP header.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: c09010ee ("ALSA: firewire-lib: handle the case that empty isochronous packet payload for CIP")
Suggested-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210520130409.GA170303@workstationSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent be22db77
...@@ -652,7 +652,6 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, ...@@ -652,7 +652,6 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
unsigned int payload_length; unsigned int payload_length;
const __be32 *cip_header; const __be32 *cip_header;
unsigned int cip_header_size; unsigned int cip_header_size;
int err;
payload_length = be32_to_cpu(ctx_header[0]) >> ISO_DATA_LENGTH_SHIFT; payload_length = be32_to_cpu(ctx_header[0]) >> ISO_DATA_LENGTH_SHIFT;
...@@ -670,6 +669,8 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, ...@@ -670,6 +669,8 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
if (cip_header_size > 0) { if (cip_header_size > 0) {
if (payload_length >= cip_header_size) { if (payload_length >= cip_header_size) {
int err;
cip_header = ctx_header + IR_CTX_HEADER_DEFAULT_QUADLETS; cip_header = ctx_header + IR_CTX_HEADER_DEFAULT_QUADLETS;
err = check_cip_header(s, cip_header, payload_length - cip_header_size, err = check_cip_header(s, cip_header, payload_length - cip_header_size,
data_blocks, data_block_counter, syt); data_blocks, data_block_counter, syt);
...@@ -683,7 +684,6 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, ...@@ -683,7 +684,6 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
} }
} else { } else {
cip_header = NULL; cip_header = NULL;
err = 0;
*data_blocks = payload_length / sizeof(__be32) / s->data_block_quadlets; *data_blocks = payload_length / sizeof(__be32) / s->data_block_quadlets;
*syt = 0; *syt = 0;
...@@ -694,7 +694,7 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, ...@@ -694,7 +694,7 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
trace_amdtp_packet(s, cycle, cip_header, payload_length, *data_blocks, trace_amdtp_packet(s, cycle, cip_header, payload_length, *data_blocks,
*data_block_counter, packet_index, index); *data_block_counter, packet_index, index);
return err; return 0;
} }
// In CYCLE_TIMER register of IEEE 1394, 7 bits are used to represent second. On // In CYCLE_TIMER register of IEEE 1394, 7 bits are used to represent second. On
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment