[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 42/66] i386/i386at/lpr.c: remove uninitialized variable
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 42/66] i386/i386at/lpr.c: remove uninitialized variable |
Date: |
Mon, 9 Dec 2013 00:11:19 +0900 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Marin Ramesa, le Thu 05 Dec 2013 22:03:36 +0100, a écrit :
> Variable lpr_alive is never initialized.
Again, it is, like all statically-allocated variables, to zero.
> I suggest a removal of
> the code that deals with this variable.
>
> But, on the other hand, maybe the variable should be initialized
> to all zero.
>
> It's not so clear from the code.
>
> * i386/i386at/lpr.c (lpr_alive): Remove variable.
> Remove the if.
>
> ---
> i386/i386at/lpr.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c
> index 557eb15..e580da9 100644
> --- a/i386/i386at/lpr.c
> +++ b/i386/i386at/lpr.c
> @@ -67,8 +67,6 @@ struct bus_driver lprdriver = {
>
> struct tty lpr_tty[NLPR];
>
> -int lpr_alive[NLPR];
> -
> int
> lprprobe(port, dev)
> struct bus_device *dev;
> @@ -85,14 +83,7 @@ struct bus_device *dev;
> outb(INTR_ENAB(addr),0x07);
> outb(DATA(addr),0xaa);
> ret = inb(DATA(addr)) == 0xaa;
> - if (ret) {
> - if (lpr_alive[unit]) {
> - printf("lpr: Multiple alive entries for unit %d.\n",
> unit);
> - printf("lpr: Ignoring entry with address = %x .\n",
> addr);
> - ret = 0;
> - } else
> - lpr_alive[unit]++;
> - }
> +
> return(ret);
> }
>
> --
> 1.8.1.4
>
>
--
Samuel
/*
* [...] Note that 120 sec is defined in the protocol as the maximum
* possible RTT. I guess we'll have to use something other than TCP
* to talk to the University of Mars.
* PAWS allows us longer timeouts and large windows, so once implemented
* ftp to mars will work nicely.
*/
(from /usr/src/linux/net/inet/tcp.c, concerning RTT [retransmission timeout])
- [PATCH 32/66] i386/i386at/com.c: remove dead assignment, (continued)
- [PATCH 32/66] i386/i386at/com.c: remove dead assignment, Marin Ramesa, 2013/12/05
- [PATCH 33/66] i386/i386at/immc.c, kd.c: use boolean instead of an int, Marin Ramesa, 2013/12/05
- [PATCH 34/66] i386/i386at/model_dep.c, kd.c: use boolean instead of an int, Marin Ramesa, 2013/12/05
- [PATCH 40/66] i386/i386at/kd.h: remove ifdef, Marin Ramesa, 2013/12/05
- [PATCH 41/66] i386/i386at/kd.h: remove ifdef, Marin Ramesa, 2013/12/05
- [PATCH 43/66] i386/i386at/rtc.c: use boolean instead of an int, Marin Ramesa, 2013/12/05
- [PATCH 42/66] i386/i386at/lpr.c: remove uninitialized variable, Marin Ramesa, 2013/12/05
- Re: [PATCH 42/66] i386/i386at/lpr.c: remove uninitialized variable,
Samuel Thibault <=
- [PATCH 44/66] i386/i386at/rtc.c: remove unused variable, Marin Ramesa, 2013/12/05
- [PATCH 45/66] i386/intel/pmap.c: use boolean instead of an int, Marin Ramesa, 2013/12/05
- [PATCH 47/66] ipc/ipc_init.c: qualify constant with const, Marin Ramesa, 2013/12/05
- [PATCH 46/66] i386/intel/pmap.c: remove unused variable, Marin Ramesa, 2013/12/05
- [PATCH 48/66] ipc/mach_port.c: use boolean instead of an int, Marin Ramesa, 2013/12/05
- [PATCH 49/66] ipc/port.h: update comment, Marin Ramesa, 2013/12/05
- [PATCH 50/66] kern/act.c, act.h: comment unused variable, Marin Ramesa, 2013/12/05
- [PATCH 51/66] kern/act.h: remove prototype without definition, Marin Ramesa, 2013/12/05
- [PATCH 52/66] kern/debug.c: initialize the lock, Marin Ramesa, 2013/12/05