From 14188ba419b980b74d964ee7d2de5fc3dd9f9a90 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 8 Mar 2017 17:00:02 -0800 Subject: 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 Reviewed-on: http://git-master/r/1318311 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/pci.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'drivers') 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, struct gk20a_platform *platform = NULL; struct gk20a *g; int err; - char *nodefmt; + char nodefmt[64]; /* make sure driver_data is a sane index */ if (pent->driver_data >= sizeof(nvgpu_pci_device) / @@ -410,17 +410,13 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, return -EINVAL; } - nodefmt = kasprintf(GFP_KERNEL, PCI_INTERFACE_NAME, dev_name(&pdev->dev)); - if (!nodefmt) - return -ENOMEM; + snprintf(nodefmt, sizeof(nodefmt), + PCI_INTERFACE_NAME, dev_name(&pdev->dev)); err = nvgpu_probe(g, "gpu_pci", nodefmt, &nvgpu_pci_class); if (err) return err; - kfree(nodefmt); - nodefmt = NULL; - err = nvgpu_pci_pm_init(&pdev->dev); if (err) { gk20a_err(&pdev->dev, "pm init failed"); -- cgit v1.2.2