public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RFC]: Clean up resource allocation in i8042 driver
@ 2005-01-21 15:14 Prarit Bhargava
  2005-01-21 15:43 ` Dmitry Torokhov
  2005-01-21 19:26 ` Dave Jones
  0 siblings, 2 replies; 11+ messages in thread
From: Prarit Bhargava @ 2005-01-21 15:14 UTC (permalink / raw)
  To: linux-kernel, vojtech

Hi,

The following patch cleans up resource allocations in the i8042 driver 
when initialization fails.

Please consider for tree application.  Patch is generated against 
current bk pull.

Thanks,

P.

Signed-off-by: Prarit Bhargava <prarit@sgi.com>

===== i8042.c 1.71 vs edited =====
--- 1.71/drivers/input/serio/i8042.c    2005-01-03 08:11:49 -05:00
+++ edited/i8042.c      2005-01-21 10:02:20 -05:00
@@ -696,7 +696,10 @@
                unsigned char param;
 
                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");
                        return -1;
                }
 
                }

@@ -1011,21 +1014,34 @@
        i8042_timer.function = i8042_timer_func;
 
        if (i8042_platform_init())
+       {
+               del_timer_sync(&i8042_timer);
                return -EBUSY;
+       }
 
        i8042_aux_values.irq = I8042_AUX_IRQ;
        i8042_kbd_values.irq = I8042_KBD_IRQ;
 
        if (i8042_controller_init())
+       {
+               i8042_platform_exit();
+               del_timer_sync(&i8042_timer);
                return -ENODEV;
+       }
 
        err = driver_register(&i8042_driver);
        if (err)
+       {
+               i8042_platform_exit();
+               del_timer_sync(&i8042_timer);
                return err;
+       }

        i8042_platform_device = platform_device_register_simple("i8042", -1, NULL, 0);
        if (IS_ERR(i8042_platform_device)) {
                driver_unregister(&i8042_driver);
+               i8042_platform_exit();
+               del_timer_sync(&i8042_timer);
                return PTR_ERR(i8042_platform_device);
        }




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-02-15  7:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-21 15:14 [PATCH][RFC]: Clean up resource allocation in i8042 driver Prarit Bhargava
2005-01-21 15:43 ` Dmitry Torokhov
2005-01-21 16:35   ` Vojtech Pavlik
2005-01-21 16:43     ` Dmitry Torokhov
2005-01-21 16:47     ` Jesse Barnes
2005-01-21 17:17       ` Prarit Bhargava
2005-02-14 16:32         ` Prarit Bhargava
2005-02-14 22:46           ` Dmitry Torokhov
2005-02-15  7:21           ` Vojtech Pavlik
2005-01-21 19:26 ` Dave Jones
2005-01-21 21:47   ` Kyle Moffett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox