summaryrefslogtreecommitdiff
path: root/kernel-devel/module-basics/vain_plat/vain_plat_2.c
blob: 1e7e396f94a1ef42d9a4cb7f68eb5f13caf0e39d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
static int vain_plat_probe(struct platform_device *pdev)
{
	struct vain_plat_info *info;
	struct resource *res, *mem;
	int err;

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

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (unlikely(!res)) {
		dev_err(&pdev->dev, "I/O address already in use\n");
		err = -ENOENT;
		goto err_free;
	}