diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/pci.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c index 50d079bb..0ce2ceef 100644 --- a/drivers/gpu/nvgpu/common/linux/pci.c +++ b/drivers/gpu/nvgpu/common/linux/pci.c | |||
@@ -443,9 +443,6 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
443 | return -EINVAL; | 443 | return -EINVAL; |
444 | } | 444 | } |
445 | 445 | ||
446 | platform = &nvgpu_pci_device[pent->driver_data]; | ||
447 | pci_set_drvdata(pdev, platform); | ||
448 | |||
449 | l = kzalloc(sizeof(*l), GFP_KERNEL); | 446 | l = kzalloc(sizeof(*l), GFP_KERNEL); |
450 | if (!l) { | 447 | if (!l) { |
451 | dev_err(&pdev->dev, "couldn't allocate gk20a support"); | 448 | dev_err(&pdev->dev, "couldn't allocate gk20a support"); |
@@ -456,6 +453,20 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
456 | 453 | ||
457 | nvgpu_kmem_init(g); | 454 | nvgpu_kmem_init(g); |
458 | 455 | ||
456 | /* Allocate memory to hold platform data*/ | ||
457 | platform = (struct gk20a_platform *)nvgpu_kzalloc( g, | ||
458 | sizeof(struct gk20a_platform)); | ||
459 | if (!platform) { | ||
460 | dev_err(&pdev->dev, "couldn't allocate platform data"); | ||
461 | return -ENOMEM; | ||
462 | } | ||
463 | |||
464 | /* copy detected device data to allocated platform space*/ | ||
465 | memcpy((void *)platform, (void *)&nvgpu_pci_device[pent->driver_data], | ||
466 | sizeof(struct gk20a_platform)); | ||
467 | |||
468 | pci_set_drvdata(pdev, platform); | ||
469 | |||
459 | err = nvgpu_init_enabled_flags(g); | 470 | err = nvgpu_init_enabled_flags(g); |
460 | if (err) { | 471 | if (err) { |
461 | kfree(g); | 472 | kfree(g); |
@@ -563,6 +574,10 @@ static void nvgpu_pci_remove(struct pci_dev *pdev) | |||
563 | enable_irq(g->irq_stall); | 574 | enable_irq(g->irq_stall); |
564 | } | 575 | } |
565 | #endif | 576 | #endif |
577 | |||
578 | /* free allocated platform data space */ | ||
579 | nvgpu_kfree(g, gk20a_get_platform(&pdev->dev)); | ||
580 | |||
566 | gk20a_get_platform(&pdev->dev)->g = NULL; | 581 | gk20a_get_platform(&pdev->dev)->g = NULL; |
567 | gk20a_put(g); | 582 | gk20a_put(g); |
568 | } | 583 | } |