summaryrefslogtreecommitdiff
path: root/kernel-devel/module-basics/vain_pci/vain_pci_2.c
blob: e0cb79102275a5488961e5590bfad320c4d1c26c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
static int vain_pci_probe(struct pci_dev *pdev,
				    const struct pci_device_id *ent)
{
	struct vain_pci_info *info;
	int ret;

	dev_dbg(&pdev->dev, "Init, new card found\n");

	info = kzalloc(sizeof(struct vain_pci_info), GFP_KERNEL);
	if (unlikely(!info)) {
		dev_err(&pdev->dev, "Could not allocate memory\n");
		ret = -ENOMEM;
		goto err_free;
	}

	info->pdev = pdev;

	ret = pci_enable_device(pdev);
	if (ret) {
		dev_err(&pdev->dev, "Failed to enable PCI Device\n");
		goto err_free;
	}