Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 32524
b: refs/heads/master
c: 91d1ed1
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Jul 13, 2006
1 parent bbb181e commit 02a3e95
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 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: a23c3a86e9952a8badb49a6bb1de455c1f5bad6d
refs/heads/master: 91d1ed1a6d225e3cf4bd8ede6235b1be65f7651a
35 changes: 26 additions & 9 deletions trunk/drivers/serial/sunsu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1406,25 +1406,35 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m
struct device_node *dp = op->node;
struct uart_sunsu_port *up;
struct resource *rp;
enum su_type type;
int err;

if (inst >= UART_NR)
return -EINVAL;
type = su_get_type(dp);
if (type == SU_PORT_PORT) {
if (inst >= UART_NR)
return -EINVAL;
up = &sunsu_ports[inst];
} else {
up = kzalloc(sizeof(*up), GFP_KERNEL);
if (!up)
return -ENOMEM;
}

up = &sunsu_ports[inst];
up->port.line = inst;

spin_lock_init(&up->port.lock);

up->su_type = su_get_type(dp);
up->su_type = type;

rp = &op->resource[0];
up->port.mapbase = op->resource[0].start;

up->port.mapbase = rp->start;
up->reg_size = (rp->end - rp->start) + 1;
up->port.membase = of_ioremap(rp, 0, up->reg_size, "su");
if (!up->port.membase)
if (!up->port.membase) {
if (type != SU_PORT_PORT)
kfree(up);
return -ENOMEM;
}

up->port.irq = op->irqs[0];

Expand All @@ -1436,8 +1446,11 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m
err = 0;
if (up->su_type == SU_PORT_KBD || up->su_type == SU_PORT_MS) {
err = sunsu_kbd_ms_init(up);
if (err)
if (err) {
kfree(up);
goto out_unmap;
}
dev_set_drvdata(&op->dev, up);

return 0;
}
Expand Down Expand Up @@ -1476,8 +1489,12 @@ static int __devexit su_remove(struct of_device *dev)
#ifdef CONFIG_SERIO
serio_unregister_port(&up->serio);
#endif
} else if (up->port.type != PORT_UNKNOWN)
kfree(up);
} else if (up->port.type != PORT_UNKNOWN) {
uart_remove_one_port(&sunsu_reg, &up->port);
}

dev_set_drvdata(&dev->dev, NULL);

return 0;
}
Expand Down

0 comments on commit 02a3e95

Please sign in to comment.