Re: [PATCH][RFC]: Clean up resource allocation in i8042 driver

From: Vojtech Pavlik
Date: Fri Jan 21 2005 - 11:37:00 EST


On Fri, Jan 21, 2005 at 10:43:36AM -0500, Dmitry Torokhov wrote:
> Hi,
>
> On Fri, 21 Jan 2005 10:14:46 -0500, Prarit Bhargava <prarit@xxxxxxx> wrote:
> > Hi,
> >
> > The following patch cleans up resource allocations in the i8042 driver
> > when initialization fails.
> >
> ...
> >
> > if (i8042_command(&param, I8042_CMD_CTL_TEST)) {
> > - printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n");
> > + if (i8042_read_status() != 0xFF)
> > + printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n");
> > + else
> > + printk(KERN_ERR "i8042.c: no i8042 controller found.\n");
>
> Is this documented somewhere?

No. But vacant ports usually return 0xff. The problem here is that 0xff
is a valid value for the status register, too. Fortunately this patch
checks for 0xff only after the timeout failed.

Anyway, I suppose we could fail silently here on ia64 machines where
ACPI is present.

> > if (i8042_platform_init())
> > + {
> > + del_timer_sync(&i8042_timer);
> > return -EBUSY;
> > + }
> >
>
> Couple of comments:
> - i8042_timer has not been started yet so there is no need to delete
> it in either of the chinks.

Indeed.

> - opening brace placement does not follow Linux coding style.
>
> I think I have some changes to i8042 in my tree, I will add
> i8042_platform_exit calls to the init routine. Thanks for noticing it!

--
Vojtech Pavlik
SuSE Labs, SuSE CR
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/