Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 101712
b: refs/heads/master
c: 73f38fe
h: refs/heads/master
v: v3
  • Loading branch information
Julia Lawall authored and Paul Mackerras committed Jul 1, 2008
1 parent c6b9670 commit 3c621f5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 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: 178f8d78fdeaace8b22a759a059b74f39caf23a4
refs/heads/master: 73f38fe1b563a9d23ffacbda7b51decf41b0c49c
34 changes: 19 additions & 15 deletions trunk/drivers/macintosh/smu.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ int __init smu_init (void)
{
struct device_node *np;
const u32 *data;
int ret = 0;

np = of_find_node_by_type(NULL, "smu");
if (np == NULL)
Expand All @@ -483,16 +484,11 @@ int __init smu_init (void)

if (smu_cmdbuf_abs == 0) {
printk(KERN_ERR "SMU: Command buffer not allocated !\n");
of_node_put(np);
return -EINVAL;
ret = -EINVAL;
goto fail_np;
}

smu = alloc_bootmem(sizeof(struct smu_device));
if (smu == NULL) {
of_node_put(np);
return -ENOMEM;
}
memset(smu, 0, sizeof(*smu));

spin_lock_init(&smu->lock);
INIT_LIST_HEAD(&smu->cmd_list);
Expand All @@ -510,14 +506,14 @@ int __init smu_init (void)
smu->db_node = of_find_node_by_name(NULL, "smu-doorbell");
if (smu->db_node == NULL) {
printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n");
goto fail;
ret = -ENXIO;
goto fail_bootmem;
}
data = of_get_property(smu->db_node, "reg", NULL);
if (data == NULL) {
of_node_put(smu->db_node);
smu->db_node = NULL;
printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n");
goto fail;
ret = -ENXIO;
goto fail_db_node;
}

/* Current setup has one doorbell GPIO that does both doorbell
Expand Down Expand Up @@ -551,7 +547,8 @@ int __init smu_init (void)
smu->db_buf = ioremap(0x8000860c, 0x1000);
if (smu->db_buf == NULL) {
printk(KERN_ERR "SMU: Can't map doorbell buffer pointer !\n");
goto fail;
ret = -ENXIO;
goto fail_msg_node;
}

/* U3 has an issue with NAP mode when issuing SMU commands */
Expand All @@ -562,10 +559,17 @@ int __init smu_init (void)
sys_ctrler = SYS_CTRLER_SMU;
return 0;

fail:
fail_msg_node:
if (smu->msg_node)
of_node_put(smu->msg_node);
fail_db_node:
of_node_put(smu->db_node);
fail_bootmem:
free_bootmem((unsigned long)smu, sizeof(struct smu_device));
smu = NULL;
return -ENXIO;

fail_np:
of_node_put(np);
return ret;
}


Expand Down

0 comments on commit 3c621f5

Please sign in to comment.