Skip to content

Commit e3173e5

Browse files
aishpantgregkh
authored andcommitted
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: Aishwarya Pant <aishpant@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8f1fff0 commit e3173e5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ int bcm2835_audio_start(struct bcm2835_alsa_stream *alsa_stream)
145145
work->alsa_stream = alsa_stream;
146146
work->cmd = BCM2835_AUDIO_START;
147147
if (!queue_work(alsa_stream->my_wq, &work->my_work)) {
148+
kfree(work);
148149
return -EBUSY;
149150
}
150151
}
@@ -168,6 +169,7 @@ int bcm2835_audio_stop(struct bcm2835_alsa_stream *alsa_stream)
168169
work->alsa_stream = alsa_stream;
169170
work->cmd = BCM2835_AUDIO_STOP;
170171
if (!queue_work(alsa_stream->my_wq, &work->my_work)) {
172+
kfree(work);
171173
return -EBUSY;
172174
}
173175
}
@@ -194,6 +196,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream,
194196
work->src = src;
195197
work->count = count;
196198
if (!queue_work(alsa_stream->my_wq, &work->my_work)) {
199+
kfree(work);
197200
return -EBUSY;
198201
}
199202
}

0 commit comments

Comments
 (0)