Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296305
b: refs/heads/master
c: 924e1d4
h: refs/heads/master
i:
  296303: d1b2024
v: v3
  • Loading branch information
Russell King committed Mar 24, 2012
1 parent 293e49b commit 7aa6b4b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 21d1c7702e74337717a1133fe8665f6591768581
refs/heads/master: 924e1d4910a1f7d53f949a92a5d7793e572bb21d
27 changes: 16 additions & 11 deletions trunk/arch/arm/common/sa1111.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@ static void sa1111_dev_release(struct device *_dev)
{
struct sa1111_dev *dev = SA1111_DEV(_dev);

release_resource(&dev->res);
kfree(dev);
}

Expand All @@ -625,9 +624,10 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent,
dev = kzalloc(sizeof(struct sa1111_dev), GFP_KERNEL);
if (!dev) {
ret = -ENOMEM;
goto out;
goto err_alloc;
}

device_initialize(&dev->dev);
dev_set_name(&dev->dev, "%4.4lx", info->offset);
dev->devid = info->devid;
dev->dev.parent = sachip->dev;
Expand Down Expand Up @@ -657,17 +657,19 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent,
if (ret) {
printk("SA1111: failed to allocate resource for %s\n",
dev->res.name);
dev_set_name(&dev->dev, NULL);
kfree(dev);
goto out;
goto err_resource;
}

ret = device_register(&dev->dev);
if (ret) {
release_resource(&dev->res);
kfree(dev);
}
ret = device_add(&dev->dev);
if (ret)
goto err_add;
return 0;

err_add:
release_resource(&dev->res);
err_resource:
put_device(&dev->dev);
err_alloc:
return ret;
}

Expand Down Expand Up @@ -813,7 +815,10 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)

static int sa1111_remove_one(struct device *dev, void *data)
{
device_unregister(dev);
struct sa1111_dev *sadev = SA1111_DEV(dev);
device_del(&sadev->dev);
release_resource(&sadev->res);
put_device(&sadev->dev);
return 0;
}

Expand Down

0 comments on commit 7aa6b4b

Please sign in to comment.