Commit 079f066a authored by Linus Torvalds's avatar Linus Torvalds

Merge http://gkernel.bkbits.net/misc-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 9356a66d d2ab7c9c
......@@ -2404,8 +2404,12 @@ static void DAC960_DetectControllers(DAC960_HardwareType_T HardwareType)
DAC960_V1_QueueReadWriteCommand;
break;
case DAC960_PD_Controller:
request_region(Controller->IO_Address, 0x80,
Controller->FullModelName);
if (!request_region(Controller->IO_Address, 0x80,
Controller->FullModelName)) {
DAC960_Error("IO port 0x%d busy for Controller at\n",
Controller, Controller->IO_Address);
goto Failure;
}
DAC960_PD_DisableInterrupts(BaseAddress);
DAC960_PD_AcknowledgeStatus(BaseAddress);
udelay(1000);
......@@ -2415,7 +2419,7 @@ static void DAC960_DetectControllers(DAC960_HardwareType_T HardwareType)
&Parameter0, &Parameter1) &&
DAC960_ReportErrorStatus(Controller, ErrorStatus,
Parameter0, Parameter1))
goto Failure;
goto Failure1;
udelay(10);
}
DAC960_PD_EnableInterrupts(Controller->BaseAddress);
......@@ -2430,8 +2434,12 @@ static void DAC960_DetectControllers(DAC960_HardwareType_T HardwareType)
DAC960_V1_QueueReadWriteCommand;
break;
case DAC960_P_Controller:
request_region(Controller->IO_Address, 0x80,
Controller->FullModelName);
if (!request_region(Controller->IO_Address, 0x80,
Controller->FullModelName)){
DAC960_Error("IO port 0x%d busy for Controller at\n",
Controller, Controller->IO_Address);
goto Failure;
}
DAC960_PD_DisableInterrupts(BaseAddress);
DAC960_PD_AcknowledgeStatus(BaseAddress);
udelay(1000);
......@@ -2441,7 +2449,7 @@ static void DAC960_DetectControllers(DAC960_HardwareType_T HardwareType)
&Parameter0, &Parameter1) &&
DAC960_ReportErrorStatus(Controller, ErrorStatus,
Parameter0, Parameter1))
goto Failure;
goto Failure1;
udelay(10);
}
DAC960_PD_EnableInterrupts(Controller->BaseAddress);
......@@ -2463,7 +2471,7 @@ static void DAC960_DetectControllers(DAC960_HardwareType_T HardwareType)
{
DAC960_Error("IRQ Channel %d illegal for Controller at\n",
Controller, IRQ_Channel);
goto Failure;
goto Failure1;
}
strcpy(Controller->FullModelName, "DAC960");
if (request_irq(IRQ_Channel, InterruptHandler, SA_SHIRQ,
......@@ -2471,7 +2479,7 @@ static void DAC960_DetectControllers(DAC960_HardwareType_T HardwareType)
{
DAC960_Error("Unable to acquire IRQ Channel %d for Controller at\n",
Controller, IRQ_Channel);
goto Failure;
goto Failure1;
}
Controller->IRQ_Channel = IRQ_Channel;
DAC960_ActiveControllerCount++;
......@@ -2481,6 +2489,8 @@ static void DAC960_DetectControllers(DAC960_HardwareType_T HardwareType)
Controller->FreeCommands = &Controller->InitialCommand;
Controller->ControllerDetectionSuccessful = true;
continue;
Failure1:
if (Controller->IO_Address) release_region(Controller->IO_Address, 0x80);
Failure:
if (IO_Address == 0)
DAC960_Error("PCI Bus %d Device %d Function %d I/O Address N/A "
......
......@@ -1069,7 +1069,7 @@ int __init mcd_init(void)
printk(KERN_ERR "mcd: Unable to get major %d for Mitsumi CD-ROM\n", MAJOR_NR);
return -EIO;
}
if (check_region(mcd_port, 4)) {
if (!request_region(mcd_port, 4, "mcd")) {
cleanup(1);
printk(KERN_ERR "mcd: Initialization failed, I/O port (%X) already in use\n", mcd_port);
return -EIO;
......@@ -1092,7 +1092,7 @@ int __init mcd_init(void)
if (count >= 2000000) {
printk(KERN_INFO "mcd: initialisation failed - No mcd device at 0x%x irq %d\n",
mcd_port, mcd_irq);
cleanup(1);
cleanup(2);
return -EIO;
}
count = inb(MCDPORT(0)); /* pick up the status */
......@@ -1102,12 +1102,12 @@ int __init mcd_init(void)
if (getValue(result + count)) {
printk(KERN_ERR "mcd: mitsumi get version failed at 0x%x\n",
mcd_port);
cleanup(1);
cleanup(2);
return -EIO;
}
if (result[0] == result[1] && result[1] == result[2]) {
cleanup(1);
cleanup(2);
return -EIO;
}
......@@ -1120,7 +1120,7 @@ int __init mcd_init(void)
if (request_irq(mcd_irq, mcd_interrupt, SA_INTERRUPT, "Mitsumi CD", NULL)) {
printk(KERN_ERR "mcd: Unable to get IRQ%d for Mitsumi CD-ROM\n", mcd_irq);
cleanup(1);
cleanup(2);
return -EIO;
}
......@@ -1134,8 +1134,6 @@ int __init mcd_init(void)
" irq=%d\n", mcd_info.speed == 1 ? "Single" : "Double",
mcd_port, mcd_irq);
request_region(mcd_port, 4, "mcd");
outb(MCMD_CONFIG_DRIVE, MCDPORT(0));
outb(0x02, MCDPORT(0));
outb(0x00, MCDPORT(0));
......
......@@ -1105,7 +1105,8 @@ int __init mcdx_init_drive(int drive)
init_waitqueue_head(&stuffp->sleepq);
/* check if i/o addresses are available */
if (check_region((unsigned int) stuffp->wreg_data, MCDX_IO_SIZE)) {
if (!request_region((unsigned int) stuffp->wreg_data, MCDX_IO_SIZE,
"mcdx")) {
xwarn("0x%3p,%d: Init failed. "
"I/O ports (0x%3p..0x%3p) already in use.\n",
stuffp->wreg_data, stuffp->irq,
......@@ -1125,6 +1126,8 @@ int __init mcdx_init_drive(int drive)
xtrace(INIT, "init() get version\n");
if (-1 == mcdx_requestversion(stuffp, &version, 4)) {
/* failed, next drive */
release_region((unsigned long) stuffp->wreg_data,
MCDX_IO_SIZE);
xwarn("%s=0x%3p,%d: Init failed. Can't get version.\n",
MCDX, stuffp->wreg_data, stuffp->irq);
xtrace(MALLOC, "init() free stuffp @ %p\n", stuffp);
......@@ -1154,6 +1157,8 @@ int __init mcdx_init_drive(int drive)
stuffp->playcmd = READ1X;
if (!stuffp->present) {
release_region((unsigned long) stuffp->wreg_data,
MCDX_IO_SIZE);
xwarn("%s=0x%3p,%d: Init failed. No Mitsumi CD-ROM?.\n",
MCDX, stuffp->wreg_data, stuffp->irq);
kfree(stuffp);
......@@ -1162,6 +1167,8 @@ int __init mcdx_init_drive(int drive)
xtrace(INIT, "init() register blkdev\n");
if (devfs_register_blkdev(MAJOR_NR, "mcdx", &mcdx_bdops) != 0) {
release_region((unsigned long) stuffp->wreg_data,
MCDX_IO_SIZE);
xwarn("%s=0x%3p,%d: Init failed. Can't get major %d.\n",
MCDX, stuffp->wreg_data, stuffp->irq, MAJOR_NR);
kfree(stuffp);
......@@ -1174,6 +1181,8 @@ int __init mcdx_init_drive(int drive)
xtrace(INIT, "init() subscribe irq and i/o\n");
mcdx_irq_map[stuffp->irq] = stuffp;
if (request_irq(stuffp->irq, mcdx_intr, SA_INTERRUPT, "mcdx", NULL)) {
release_region((unsigned long) stuffp->wreg_data,
MCDX_IO_SIZE);
xwarn("%s=0x%3p,%d: Init failed. Can't get irq (%d).\n",
MCDX, stuffp->wreg_data, stuffp->irq, stuffp->irq);
stuffp->irq = 0;
......@@ -1181,8 +1190,6 @@ int __init mcdx_init_drive(int drive)
kfree(stuffp);
return 0;
}
request_region((unsigned int) stuffp->wreg_data,
MCDX_IO_SIZE, "mcdx");
xtrace(INIT, "init() get garbage\n");
{
......
......@@ -2008,7 +2008,7 @@ int __init optcd_init(void)
"optcd: no Optics Storage CDROM Initialization\n");
return -EIO;
}
if (check_region(optcd_port, 4)) {
if (!request_region(optcd_port, 4, "optcd")) {
printk(KERN_ERR "optcd: conflict, I/O port 0x%x already used\n",
optcd_port);
return -EIO;
......@@ -2016,21 +2016,25 @@ int __init optcd_init(void)
if (!reset_drive()) {
printk(KERN_ERR "optcd: drive at 0x%x not ready\n", optcd_port);
release_region(optcd_port, 4);
return -EIO;
}
if (!version_ok()) {
printk(KERN_ERR "optcd: unknown drive detected; aborting\n");
release_region(optcd_port, 4);
return -EIO;
}
status = exec_cmd(COMINITDOUBLE);
if (status < 0) {
printk(KERN_ERR "optcd: cannot init double speed mode\n");
release_region(optcd_port, 4);
DEBUG((DEBUG_VFS, "exec_cmd COMINITDOUBLE: %02x", -status));
return -EIO;
}
if (devfs_register_blkdev(MAJOR_NR, "optcd", &opt_fops) != 0)
{
printk(KERN_ERR "optcd: unable to get major %d\n", MAJOR_NR);
release_region(optcd_port, 4);
return -EIO;
}
devfs_register (NULL, "optcd", DEVFS_FL_DEFAULT, MAJOR_NR, 0,
......@@ -2038,7 +2042,6 @@ int __init optcd_init(void)
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_optcd_request,
&optcd_lock);
blk_queue_hardsect_size(BLK_DEFAULT_QUEUE(MAJOR_NR), 2048);
request_region(optcd_port, 4, "optcd");
register_disk(NULL, mk_kdev(MAJOR_NR,0), 1, &opt_fops, 0);
printk(KERN_INFO "optcd: DOLPHIN 8000 AT CDROM at 0x%x\n", optcd_port);
......
......@@ -1254,7 +1254,11 @@ static int isicom_write(struct tty_struct * tty, int from_user,
created more space in xmit_buf when the ctrl
gets back here */
sti();
copy_from_user(tmp_buf, buf, cnt);
if (copy_from_user(tmp_buf, buf, cnt)) {
up(&tmp_buf_sem);
restore_flags(flags);
return -EFAULT;
}
cli();
cnt = MIN(cnt, MIN(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
SERIAL_XMIT_SIZE - port->xmit_head));
......
......@@ -712,7 +712,7 @@ static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tio
static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts);
static long stli_mktiocm(unsigned long sigvalue);
static void stli_read(stlibrd_t *brdp, stliport_t *portp);
static void stli_getserial(stliport_t *portp, struct serial_struct *sp);
static int stli_getserial(stliport_t *portp, struct serial_struct *sp);
static int stli_setserial(stliport_t *portp, struct serial_struct *sp);
static int stli_getbrdstats(combrd_t *bp);
static int stli_getportstats(stliport_t *portp, comstats_t *cp);
......@@ -1676,7 +1676,8 @@ static int stli_write(struct tty_struct *tty, int from_user, const unsigned char
restore_flags(flags);
down(&stli_tmpwritesem);
copy_from_user(stli_tmpwritebuf, chbuf, count);
if (copy_from_user(stli_tmpwritebuf, chbuf, count))
return -EFAULT;
chbuf = &stli_tmpwritebuf[0];
}
......@@ -1977,7 +1978,7 @@ static int stli_charsinbuffer(struct tty_struct *tty)
* Generate the serial struct info.
*/
static void stli_getserial(stliport_t *portp, struct serial_struct *sp)
static int stli_getserial(stliport_t *portp, struct serial_struct *sp)
{
struct serial_struct sio;
stlibrd_t *brdp;
......@@ -2002,7 +2003,8 @@ static void stli_getserial(stliport_t *portp, struct serial_struct *sp)
if (brdp != (stlibrd_t *) NULL)
sio.port = brdp->iobase;
copy_to_user(sp, &sio, sizeof(struct serial_struct));
return copy_to_user(sp, &sio, sizeof(struct serial_struct)) ?
-EFAULT : 0;
}
/*****************************************************************************/
......@@ -2129,7 +2131,7 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
case TIOCGSERIAL:
if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
sizeof(struct serial_struct))) == 0)
stli_getserial(portp, (struct serial_struct *) arg);
rc = stli_getserial(portp, (struct serial_struct *) arg);
break;
case TIOCSSERIAL:
if ((rc = verify_area(VERIFY_READ, (void *) arg,
......@@ -3972,7 +3974,7 @@ static inline int stli_initecp(stlibrd_t *brdp)
printk(KERN_DEBUG "stli_initecp(brdp=%x)\n", (int) brdp);
#endif
if (!request_region(brdp->iobase, brdp->iosize, name))
if (!request_region(brdp->iobase, brdp->iosize, "istallion"))
return -EIO;
if ((brdp->iobase == 0) || (brdp->memaddr == 0))
......@@ -4140,7 +4142,7 @@ static inline int stli_initonb(stlibrd_t *brdp)
brdp->iosize = ONB_IOSIZE;
if (!request_region(brdp->iobase, brdp->iosize, name))
if (!request_region(brdp->iobase, brdp->iosize, "istallion"))
return -EIO;
/*
......
......@@ -521,7 +521,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof
static int stl_brdinit(stlbrd_t *brdp);
static int stl_initports(stlbrd_t *brdp, stlpanel_t *panelp);
static int stl_mapirq(int irq, char *name);
static void stl_getserial(stlport_t *portp, struct serial_struct *sp);
static int stl_getserial(stlport_t *portp, struct serial_struct *sp);
static int stl_setserial(stlport_t *portp, struct serial_struct *sp);
static int stl_getbrdstats(combrd_t *bp);
static int stl_getportstats(stlport_t *portp, comstats_t *cp);
......@@ -1332,7 +1332,8 @@ static int stl_write(struct tty_struct *tty, int from_user, const unsigned char
count = MIN(len, count);
down(&stl_tmpwritesem);
copy_from_user(stl_tmpwritebuf, chbuf, count);
if (copy_from_user(stl_tmpwritebuf, chbuf, count))
return -EFAULT;
chbuf = &stl_tmpwritebuf[0];
}
......@@ -1504,7 +1505,7 @@ static int stl_charsinbuffer(struct tty_struct *tty)
* Generate the serial struct info.
*/
static void stl_getserial(stlport_t *portp, struct serial_struct *sp)
static int stl_getserial(stlport_t *portp, struct serial_struct *sp)
{
struct serial_struct sio;
stlbrd_t *brdp;
......@@ -1534,7 +1535,7 @@ static void stl_getserial(stlport_t *portp, struct serial_struct *sp)
if (brdp != (stlbrd_t *) NULL)
sio.irq = brdp->irq;
copy_to_user(sp, &sio, sizeof(struct serial_struct));
return copy_to_user(sp, &sio, sizeof(struct serial_struct)) ? -EFAULT : 0;
}
/*****************************************************************************/
......@@ -1648,7 +1649,7 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd
case TIOCGSERIAL:
if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
sizeof(struct serial_struct))) == 0)
stl_getserial(portp, (struct serial_struct *) arg);
rc = stl_getserial(portp, (struct serial_struct *) arg);
break;
case TIOCSSERIAL:
if ((rc = verify_area(VERIFY_READ, (void *) arg,
......
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