提交 e3173e57 编写于 作者: A Aishwarya Pant 提交者: Greg Kroah-Hartman

staging: bcm2835-audio: deallocate work when queue_work(...) fails

This patch de-allocates work when queue_work(..) fails in the
bcm2835-audio work functions
Signed-off-by: NAishwarya Pant <aishpant@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 8f1fff07
...@@ -145,6 +145,7 @@ int bcm2835_audio_start(struct bcm2835_alsa_stream *alsa_stream) ...@@ -145,6 +145,7 @@ int bcm2835_audio_start(struct bcm2835_alsa_stream *alsa_stream)
work->alsa_stream = alsa_stream; work->alsa_stream = alsa_stream;
work->cmd = BCM2835_AUDIO_START; work->cmd = BCM2835_AUDIO_START;
if (!queue_work(alsa_stream->my_wq, &work->my_work)) { if (!queue_work(alsa_stream->my_wq, &work->my_work)) {
kfree(work);
return -EBUSY; return -EBUSY;
} }
} }
...@@ -168,6 +169,7 @@ int bcm2835_audio_stop(struct bcm2835_alsa_stream *alsa_stream) ...@@ -168,6 +169,7 @@ int bcm2835_audio_stop(struct bcm2835_alsa_stream *alsa_stream)
work->alsa_stream = alsa_stream; work->alsa_stream = alsa_stream;
work->cmd = BCM2835_AUDIO_STOP; work->cmd = BCM2835_AUDIO_STOP;
if (!queue_work(alsa_stream->my_wq, &work->my_work)) { if (!queue_work(alsa_stream->my_wq, &work->my_work)) {
kfree(work);
return -EBUSY; return -EBUSY;
} }
} }
...@@ -194,6 +196,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, ...@@ -194,6 +196,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream,
work->src = src; work->src = src;
work->count = count; work->count = count;
if (!queue_work(alsa_stream->my_wq, &work->my_work)) { if (!queue_work(alsa_stream->my_wq, &work->my_work)) {
kfree(work);
return -EBUSY; return -EBUSY;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册