2001-03-05 12:37:58

by Andrey Panin

[permalink] [raw]
Subject: [PATCH] /drivers/char/serial.c cleanup

Hi all,

I already sent this patch some days ago, but didn't get an answer :(
So, i'm trying to resubmit it.

Attached patch (2.4.2-ac11) makes some changes in serial driver:
adds ioremap() return code checks, removes panic() calls
and adds better error handling in start_pci_pnp_board() function.

Best regards.

--
Andrey Panin | Embedded systems software engineer
[email protected] | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc


Attachments:
patch-serial (3.39 kB)
(No filename) (232.00 B)
Download all attachments

2001-03-05 12:49:19

by Philipp Rumpf

[permalink] [raw]
Subject: Re: [PATCH] /drivers/char/serial.c cleanup

On Mon, Mar 05, 2001 at 03:37:04PM +0300, Andrey Panin wrote:
> Attached patch (2.4.2-ac11) makes some changes in serial driver:
> adds ioremap() return code checks, removes panic() calls
> and adds better error handling in start_pci_pnp_board() function.

Did you test it ?

> diff -u /linux.vanilla/drivers/char/serial.c /linux/drivers/char/serial.c
> --- /linux.vanilla/drivers/char/serial.c Thu Mar 1 20:15:43 2001
> +++ /linux/drivers/char/serial.c Fri Mar 2 00:10:29 2001
> @@ -3876,7 +3876,10 @@
> return 0;
> }
> req->io_type = SERIAL_IO_MEM;
> - req->iomem_base = ioremap(port, board->uart_offset);
> + if ((req->iomem_base = ioremap(port, board->uart_offset))) {
> + printk(KERN_ERR "serial: Couldn's remap IO memory at %#lx\n", port);
> + return 1;
> + }

This seems wrong. ioremap returns NULL in case of failure.

2001-03-05 13:00:31

by Andrey Panin

[permalink] [raw]
Subject: Re: [PATCH] /drivers/char/serial.c cleanup

On Mon, Mar 05, 2001 at 06:48:29AM -0600, Philipp Rumpf wrote:
> On Mon, Mar 05, 2001 at 03:37:04PM +0300, Andrey Panin wrote:
> > Attached patch (2.4.2-ac11) makes some changes in serial driver:
> > adds ioremap() return code checks, removes panic() calls
> > and adds better error handling in start_pci_pnp_board() function.
>
> Did you test it ?

Partially (without my ISAPNP modem, lack of ISA slots)

>
> > diff -u /linux.vanilla/drivers/char/serial.c /linux/drivers/char/serial.c
> > --- /linux.vanilla/drivers/char/serial.c Thu Mar 1 20:15:43 2001
> > +++ /linux/drivers/char/serial.c Fri Mar 2 00:10:29 2001
> > @@ -3876,7 +3876,10 @@
> > return 0;
> > }
> > req->io_type = SERIAL_IO_MEM;
> > - req->iomem_base = ioremap(port, board->uart_offset);
> > + if ((req->iomem_base = ioremap(port, board->uart_offset))) {
> > + printk(KERN_ERR "serial: Couldn's remap IO memory at %#lx\n", port);
> > + return 1;
> > + }
>
> This seems wrong. ioremap returns NULL in case of failure.

Of course it's a typo, stupid me :((
What about attached patch ?

--
Andrey Panin | Embedded systems software engineer
[email protected] | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc


Attachments:
patch-serial (3.39 kB)
(No filename) (232.00 B)
Download all attachments

2001-03-05 15:45:17

by Theodore Tso

[permalink] [raw]
Subject: Re: [PATCH] /drivers/char/serial.c cleanup

Date: Mon, 5 Mar 2001 15:37:04 +0300
From: Andrey Panin <[email protected]>

I already sent this patch some days ago, but didn't get an answer :(
So, i'm trying to resubmit it.

Thanks for submitting it; the general idea of the patch looks good, but
as prumpf pointed out, the test for ioremap is reversed, so it looks
like it hasn't been tested.

I'll fix it up and send it on to Linus.

- Ted