Commit be1fd94f authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6:
  [PATCH] scx200_acb: Fix for the CS5535 errata
  [PATCH] scx200_acb: Fix resource name use after free
  [PATCH] scx200_acb: Fix return on init error
parents 0d38edda 95563d34
...@@ -133,6 +133,9 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status) ...@@ -133,6 +133,9 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status)
outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1); outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1);
outb(ACBST_STASTR | ACBST_NEGACK, ACBST); outb(ACBST_STASTR | ACBST_NEGACK, ACBST);
/* Reset the status register */
outb(0, ACBST);
return; return;
} }
...@@ -228,6 +231,10 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface) ...@@ -228,6 +231,10 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface)
timeout = jiffies + POLL_TIMEOUT; timeout = jiffies + POLL_TIMEOUT;
while (time_before(jiffies, timeout)) { while (time_before(jiffies, timeout)) {
status = inb(ACBST); status = inb(ACBST);
/* Reset the status register to avoid the hang */
outb(0, ACBST);
if ((status & (ACBST_SDAST|ACBST_BER|ACBST_NEGACK)) != 0) { if ((status & (ACBST_SDAST|ACBST_BER|ACBST_NEGACK)) != 0) {
scx200_acb_machine(iface, status); scx200_acb_machine(iface, status);
return; return;
...@@ -415,7 +422,6 @@ static int __init scx200_acb_create(const char *text, int base, int index) ...@@ -415,7 +422,6 @@ static int __init scx200_acb_create(const char *text, int base, int index)
struct scx200_acb_iface *iface; struct scx200_acb_iface *iface;
struct i2c_adapter *adapter; struct i2c_adapter *adapter;
int rc; int rc;
char description[64];
iface = kzalloc(sizeof(*iface), GFP_KERNEL); iface = kzalloc(sizeof(*iface), GFP_KERNEL);
if (!iface) { if (!iface) {
...@@ -434,10 +440,7 @@ static int __init scx200_acb_create(const char *text, int base, int index) ...@@ -434,10 +440,7 @@ static int __init scx200_acb_create(const char *text, int base, int index)
mutex_init(&iface->mutex); mutex_init(&iface->mutex);
snprintf(description, sizeof(description), "%s ACCESS.bus [%s]", if (!request_region(base, 8, adapter->name)) {
text, adapter->name);
if (request_region(base, 8, description) == 0) {
printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n", printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n",
base, base + 8-1); base, base + 8-1);
rc = -EBUSY; rc = -EBUSY;
...@@ -524,6 +527,9 @@ static int __init scx200_acb_init(void) ...@@ -524,6 +527,9 @@ static int __init scx200_acb_init(void)
} else if (pci_dev_present(divil_pci)) } else if (pci_dev_present(divil_pci))
rc = scx200_add_cs553x(); rc = scx200_add_cs553x();
/* If at least one bus was created, init must succeed */
if (scx200_acb_list)
return 0;
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment