Skip to contentSkip to conversation

Input: i8042 fix refcount leak

PATCH In review Yangtao Li 2 participants 3 messages Dec 9, 2018

Subsystems (2)
lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH v2 1/1 Input: i8042 fix refcount leak

use of_node_put() to release the refcount.

---
 drivers/input/serio/i8042-sparcio.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/input/serio/i8042-sparcio.h +5 -1
index 796289846204..cc6777b4c4ea 100644
@@ -111,13 +111,17 @@ static int __init i8042_platform_init(void)
 	struct device_node *root = of_find_node_by_path("/");
 
 	if (!strcmp(root->name, "SUNW,JavaStation-1")) {
+		of_node_put(root);
 		/* Hardcoded values for MrCoffee.  */
 		i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
 		kbd_iobase = ioremap(0x71300060, 8);
 		if (!kbd_iobase)
 			return -ENODEV;
 	} else {
-		int err = platform_driver_register(&sparc_i8042_driver);
+		int err;
+
+		of_node_put(root);
+		err = platform_driver_register(&sparc_i8042_driver);
 		if (err)
 			return err;
 
Signature · 1 line
2.17.0
maintainer
#1 lore raw
Quoted 19 lines · Yangtao Li

use of_node_put() to release the refcount.

---
 drivers/input/serio/i8042-sparcio.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/input/serio/i8042-sparcio.h +1 -0
index 796289846204..cc6777b4c4ea 100644
@@ -111,13 +111,17 @@ static int __init i8042_platform_init(void)
 	struct device_node *root = of_find_node_by_path("/");
 
 	if (!strcmp(root->name, "SUNW,JavaStation-1")) {
+		of_node_put(root);
 		/* Hardcoded values for MrCoffee.  */
 		i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
 		kbd_iobase = ioremap(0x71300060, 8);

drivers/input/serio/i8042-sparcio.h static int __init i8042_platform_init(void) · line 126

Quoted 10 lines
drivers/input/serio/i8042-sparcio.h +4 -1
 		if (!kbd_iobase)
 			return -ENODEV;
 	} else {
-		int err = platform_driver_register(&sparc_i8042_driver);
+		int err;
+
+		of_node_put(root);
+		err = platform_driver_register(&sparc_i8042_driver);
 		if (err)
 			return err;

This is not really what I asked for, as in this version you left out leaky reference in i8042_platform_exit(). Please make the "detect Mr Coffee" function and use it in both i8042_platform_init() and i8042_platform_exit().

Thanks.

Signature · 1 line
Dmitry
author
#2 lore raw
Quoted 28 lines · Dmitry Torokhov
Quoted 26 lines · Yangtao Li

use of_node_put() to release the refcount.

---
 drivers/input/serio/i8042-sparcio.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/input/serio/i8042-sparcio.h +4 -1
index 796289846204..cc6777b4c4ea 100644
@@ -111,13 +111,17 @@ static int __init i8042_platform_init(void)
      struct device_node *root = of_find_node_by_path("/");
 
      if (!strcmp(root->name, "SUNW,JavaStation-1")) {
+             of_node_put(root);
              /* Hardcoded values for MrCoffee.  */
              i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
              kbd_iobase = ioremap(0x71300060, 8);
              if (!kbd_iobase)
                      return -ENODEV;
      } else {
-             int err = platform_driver_register(&sparc_i8042_driver);
+             int err;
+
+             of_node_put(root);
Quoted 8 lines

drivers/input/serio/i8042-sparcio.h static int __init i8042_platform_init(void) · line 126

Quoted 3 lines
drivers/input/serio/i8042-sparcio.h +1 -0
+             err = platform_driver_register(&sparc_i8042_driver);
              if (err)
                      return err;

This is not really what I asked for, as in this version you left out leaky reference in i8042_platform_exit(). Please make the "detect Mr Coffee" function and use it in both i8042_platform_init() and i8042_platform_exit().

How about the newer?

Yours,
Yangtao

Quoted 5 lines

Thanks.

--
Dmitry