]> git.droids-corp.org - dpdk.git/blobdiff - drivers/gpu/cuda/cuda.c
gpu/cuda: fix memory list cleanup
[dpdk.git] / drivers / gpu / cuda / cuda.c
index 882df08e56bee00af190c716b9b86a97ebeb0ac2..d3a7234a09b55a27b06cf481acef4f94fb1ad568 100644 (file)
@@ -437,9 +437,11 @@ mem_list_del_item(cuda_ptr_key pk)
                return -EINVAL;
 
        /* if key is in head */
-       if (mem_alloc_list_cur->prev == NULL)
+       if (mem_alloc_list_cur->prev == NULL) {
                mem_alloc_list_head = mem_alloc_list_cur->next;
-       else {
+               if (mem_alloc_list_head != NULL)
+                       mem_alloc_list_head->prev = NULL;
+       } else {
                mem_alloc_list_cur->prev->next = mem_alloc_list_cur->next;
                if (mem_alloc_list_cur->next != NULL)
                        mem_alloc_list_cur->next->prev = mem_alloc_list_cur->prev;