summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Siddhabhaktula <vsiddhabhakt@nvidia.com>2021-10-28 08:17:20 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2021-11-25 10:24:41 -0500
commitde418f6ef634220194514a72db332d9fba350856 (patch)
treea5cb8b902f3dc9c73cb218741dc74aab9e7d077d
parent4d17d8b10431b1ba5775d35b34e76dbb8f9b448a (diff)
nvgpu: fix incorrect mem_desc_count
- Fix incorrect mem_desc_count increment in the case of failure - Increment it only when there is a success Bug 3399680 Change-Id: I8c04e4859422fb86367113c58ce3e34cab952b63 Signed-off-by: Vikas Siddhabhaktula <vsiddhabhakt@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2618229 Reviewed-by: Thomas Steinle <tsteinle@nvidia.com> Reviewed-by: Phoenix Jung <pjung@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c
index 1f537d48..926f243d 100644
--- a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Virtualized GPU Memory Management 2 * Virtualized GPU Memory Management
3 * 3 *
4 * Copyright (c) 2015-2020, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2015-2021, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
@@ -130,11 +130,12 @@ u64 vgpu_gp10b_locked_gmmu_map(struct vm_gk20a *vm,
130 chunk_length = min(size, 130 chunk_length = min(size,
131 nvgpu_sgt_get_length(sgt, sgl) - space_to_skip); 131 nvgpu_sgt_get_length(sgt, sgl) - space_to_skip);
132 132
133 if (add_mem_desc(&mem_desc[mem_desc_count++], phys_addr, 133 if (add_mem_desc(&mem_desc[mem_desc_count], phys_addr,
134 chunk_length, &oob_size)) { 134 chunk_length, &oob_size)) {
135 err = -ENOMEM; 135 err = -ENOMEM;
136 goto fail; 136 goto fail;
137 } 137 }
138 mem_desc_count++;
138 139
139 space_to_skip = 0; 140 space_to_skip = 0;
140 size -= chunk_length; 141 size -= chunk_length;