habanalabs: remove node from list before freeing the node
authorKoby Elbaz <kelbaz@habana.ai>
Wed, 9 Jun 2021 18:43:52 +0000 (21:43 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Fri, 18 Jun 2021 12:23:42 +0000 (15:23 +0300)
fix the following smatch warnings:

goya_pin_memory_before_cs()
warn: '&userptr->job_node' not removed from list

gaudi_pin_memory_before_cs()
warn: '&userptr->job_node' not removed from list

Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/gaudi/gaudi.c
drivers/misc/habanalabs/goya/goya.c

index ca1a8ca..a46ec60 100644 (file)
@@ -5046,6 +5046,7 @@ already_pinned:
        return 0;
 
 unpin_memory:
+       list_del(&userptr->job_node);
        hl_unpin_host_memory(hdev, userptr);
 free_userptr:
        kfree(userptr);
index 2a9b91d..e91b730 100644 (file)
@@ -3326,6 +3326,7 @@ already_pinned:
        return 0;
 
 unpin_memory:
+       list_del(&userptr->job_node);
        hl_unpin_host_memory(hdev, userptr);
 free_userptr:
        kfree(userptr);