summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-03-08 20:00:02 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-22 21:37:05 -0400
commit14188ba419b980b74d964ee7d2de5fc3dd9f9a90 (patch)
treea4739fd179d3ddba0299568362f6b3f36b6c090e /drivers
parenta0a081d0654ac4a2e888aa49ed5fc8840768c107 (diff)
gpu: nvgpu: Use new kmem API functions (pci.c)
Really just delete the usage of kasprintf() since that must be paired with a kfree(). Since the kasprintf() doesn't use the nvgpu kmem machinery (and is Linux specific) instead use a small buffer statically allocated on the stack. Bug 1799159 Bug 1823380 Change-Id: Ic26f39da401df926024c67e8ff5d979f683a6d3e Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1318311 Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/pci.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/pci.c b/drivers/gpu/nvgpu/pci.c
index 0ed621ce..1e66b7c9 100644
--- a/drivers/gpu/nvgpu/pci.c
+++ b/drivers/gpu/nvgpu/pci.c
@@ -337,7 +337,7 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
337 struct gk20a_platform *platform = NULL; 337 struct gk20a_platform *platform = NULL;
338 struct gk20a *g; 338 struct gk20a *g;
339 int err; 339 int err;
340 char *nodefmt; 340 char nodefmt[64];
341 341
342 /* make sure driver_data is a sane index */ 342 /* make sure driver_data is a sane index */
343 if (pent->driver_data >= sizeof(nvgpu_pci_device) / 343 if (pent->driver_data >= sizeof(nvgpu_pci_device) /
@@ -410,17 +410,13 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
410 return -EINVAL; 410 return -EINVAL;
411 } 411 }
412 412
413 nodefmt = kasprintf(GFP_KERNEL, PCI_INTERFACE_NAME, dev_name(&pdev->dev)); 413 snprintf(nodefmt, sizeof(nodefmt),
414 if (!nodefmt) 414 PCI_INTERFACE_NAME, dev_name(&pdev->dev));
415 return -ENOMEM;
416 415
417 err = nvgpu_probe(g, "gpu_pci", nodefmt, &nvgpu_pci_class); 416 err = nvgpu_probe(g, "gpu_pci", nodefmt, &nvgpu_pci_class);
418 if (err) 417 if (err)
419 return err; 418 return err;
420 419
421 kfree(nodefmt);
422 nodefmt = NULL;
423
424 err = nvgpu_pci_pm_init(&pdev->dev); 420 err = nvgpu_pci_pm_init(&pdev->dev);
425 if (err) { 421 if (err) {
426 gk20a_err(&pdev->dev, "pm init failed"); 422 gk20a_err(&pdev->dev, "pm init failed");