hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/gpu/drm/ttm/ttm_bo_util.c
....@@ -181,15 +181,13 @@
181181 return -ENOMEM;
182182
183183 src = (void *)((unsigned long)src + (page << PAGE_SHIFT));
184
- /*
185
- * Ensure that a highmem page is mapped with the correct
186
- * pgprot. For non highmem the mapping is already there.
187
- */
188
- dst = kmap_local_page_prot(d, prot);
184
+ dst = kmap_atomic_prot(d, prot);
185
+ if (!dst)
186
+ return -ENOMEM;
189187
190188 memcpy_fromio(dst, src, PAGE_SIZE);
191189
192
- kunmap_local(dst);
190
+ kunmap_atomic(dst);
193191
194192 return 0;
195193 }
....@@ -205,15 +203,13 @@
205203 return -ENOMEM;
206204
207205 dst = (void *)((unsigned long)dst + (page << PAGE_SHIFT));
208
- /*
209
- * Ensure that a highmem page is mapped with the correct
210
- * pgprot. For non highmem the mapping is already there.
211
- */
212
- src = kmap_local_page_prot(s, prot);
206
+ src = kmap_atomic_prot(s, prot);
207
+ if (!src)
208
+ return -ENOMEM;
213209
214210 memcpy_toio(dst, src, PAGE_SIZE);
215211
216
- kunmap_local(src);
212
+ kunmap_atomic(src);
217213
218214 return 0;
219215 }