Commit 8b6e2193 authored by Dan Carpenter's avatar Dan Carpenter Committed by Takashi Iwai

ALSA: firewire-lib: fix error codes for allocation failure

Return -ENOMEM if kcalloc() fails.  Currently the code returns success.

Fixes: f9e5ecdf ("ALSA: firewire-lib: add replay target to cache sequence of packet")
Fixes: 6f24bb8a ("ALSA: firewire-lib: pool sequence of packet in IT context independently")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/YLtyL4VoArwVLor1@mwandaSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 745f260b
......@@ -1625,9 +1625,11 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
s->ctx_data.tx.cache.tail = 0;
s->ctx_data.tx.cache.descs = kcalloc(s->ctx_data.tx.cache.size,
sizeof(*s->ctx_data.tx.cache.descs), GFP_KERNEL);
if (!s->ctx_data.tx.cache.descs)
if (!s->ctx_data.tx.cache.descs) {
err = -ENOMEM;
goto err_context;
}
}
} else {
static const struct {
unsigned int data_block;
......@@ -1643,8 +1645,10 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
};
s->ctx_data.rx.seq.descs = kcalloc(queue_size, sizeof(*s->ctx_data.rx.seq.descs), GFP_KERNEL);
if (!s->ctx_data.rx.seq.descs)
if (!s->ctx_data.rx.seq.descs) {
err = -ENOMEM;
goto err_context;
}
s->ctx_data.rx.seq.size = queue_size;
s->ctx_data.rx.seq.tail = 0;
s->ctx_data.rx.seq.head = 0;
......
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