Commit 691e21ba authored by William Stinson's avatar William Stinson Committed by Christoph Hellwig

[PATCH] small region change for baycom_ser_hdx.c

this is a small patch for baycom_ser_hdx.c  -- baycom ser12 halfduplex radio modem driver to
    1) remove call to check_region using request_region instead
    2) check the status of call to request_region
    3) release allocated region resource in case of error.

I don't have this hardware so compilation checked only.
parent b547fa90
...@@ -476,19 +476,22 @@ static int ser12_open(struct net_device *dev) ...@@ -476,19 +476,22 @@ static int ser12_open(struct net_device *dev)
if (!dev->base_addr || dev->base_addr > 0x1000-SER12_EXTENT || if (!dev->base_addr || dev->base_addr > 0x1000-SER12_EXTENT ||
dev->irq < 2 || dev->irq > 15) dev->irq < 2 || dev->irq > 15)
return -ENXIO; return -ENXIO;
if (check_region(dev->base_addr, SER12_EXTENT)) if (!request_region(dev->base_addr, SER12_EXTENT, "baycom_ser12"))
return -EACCES; return -EACCES;
memset(&bc->modem, 0, sizeof(bc->modem)); memset(&bc->modem, 0, sizeof(bc->modem));
bc->hdrv.par.bitrate = 1200; bc->hdrv.par.bitrate = 1200;
if ((u = ser12_check_uart(dev->base_addr)) == c_uart_unknown) if ((u = ser12_check_uart(dev->base_addr)) == c_uart_unknown) {
release_region(dev->base_addr, SER12_EXTENT);
return -EIO; return -EIO;
}
outb(0, FCR(dev->base_addr)); /* disable FIFOs */ outb(0, FCR(dev->base_addr)); /* disable FIFOs */
outb(0x0d, MCR(dev->base_addr)); outb(0x0d, MCR(dev->base_addr));
outb(0, IER(dev->base_addr)); outb(0, IER(dev->base_addr));
if (request_irq(dev->irq, ser12_interrupt, SA_INTERRUPT | SA_SHIRQ, if (request_irq(dev->irq, ser12_interrupt, SA_INTERRUPT | SA_SHIRQ,
"baycom_ser12", dev)) "baycom_ser12", dev)) {
release_region(dev->base_addr, SER12_EXTENT);
return -EBUSY; return -EBUSY;
request_region(dev->base_addr, SER12_EXTENT, "baycom_ser12"); }
/* /*
* enable transmitter empty interrupt * enable transmitter empty interrupt
*/ */
......
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