Skip to content

Commit

Permalink
amdkfd: Set *buffer_ptr to NULL in case of error
Browse files Browse the repository at this point in the history
In function acquire_packet_buffer() we may return -ENOMEM. In that case, we
should set the *buffer_ptr to NULL, so that calling functions which check the
*buffer_ptr value as a criteria for success, will know that
acquire_packet_buffer() failed.

Reviewed-by: Alexey Skidanov <alexey.skidanov@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
  • Loading branch information
Oded Gabbay committed Dec 4, 2014
1 parent c448a14 commit a550bb3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,14 @@ static int acquire_packet_buffer(struct kernel_queue *kq,
queue_size_dwords;

if (packet_size_in_dwords >= queue_size_dwords ||
packet_size_in_dwords >= available_size)
packet_size_in_dwords >= available_size) {
/*
* make sure calling functions know
* acquire_packet_buffer() failed
*/
*buffer_ptr = NULL;
return -ENOMEM;
}

if (wptr + packet_size_in_dwords >= queue_size_dwords) {
while (wptr > 0) {
Expand Down

0 comments on commit a550bb3

Please sign in to comment.