diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-06-05 15:46:39 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-06-06 11:04:54 +0300 |
commit | 8b6e219317480aa8457d9bd91dc2f4d8524bdba1 (patch) | |
tree | 1599eac6d04fdd520c3dc0ecd4a9b59cdde82b4a /sound/firewire | |
parent | 745f260b77e5e9de4f756d4a7cda510c616bb279 (diff) | |
download | linux-8b6e219317480aa8457d9bd91dc2f4d8524bdba1.tar.xz |
ALSA: firewire-lib: fix error codes for allocation failure
Return -ENOMEM if kcalloc() fails. Currently the code returns success.
Fixes: f9e5ecdfc2c2 ("ALSA: firewire-lib: add replay target to cache sequence of packet")
Fixes: 6f24bb8a157c ("ALSA: firewire-lib: pool sequence of packet in IT context independently")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/YLtyL4VoArwVLor1@mwanda
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire')
-rw-r--r-- | sound/firewire/amdtp-stream.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 945597ffacc2..b37cec3cc579 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -1625,8 +1625,10 @@ 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 { @@ -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; |