ppdev: fix memory leak
Subsystems (2)
Sudip Mukherjee
maintainerPATCH 1/3 ppdev: fix memory leak
The variable name was only released if parport_register_dev_model() fails. Now that we are using the device-model the parport driver will duplicate the name and use it. So we can release the variable after the device has been registered with the parport.
Suggested-by Arnd Bergmann <[email protected]>
Signed-off-by Sudip Mukherjee <[email protected]>
--- drivers/char/ppdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/ppdev.c +1 -1
@@ -305,10 +305,10 @@ static int register_device(int minor, struct pp_struct *pp) ppdev_cb.private = pp; pdev =parport_register_dev_model (port, name, &ppdev_cb, minor);parport_put_port (port); +kfree (name);if (!pdev) {printk (KERN_WARNING "%s: failed to register device!\n" , name); -kfree (name);return -ENXIO ; }
Signature · 1 line
1.9.1
Sudip Mukherjee
maintainerPATCH 2/3 MAINTAINERS: update email
I am no longer with Vector India. Update my email.
Signed-off-by Sudip Mukherjee <[email protected]>
--- MAINTAINERS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
MAINTAINERS +3 -3
@@ -9084,7 +9084,7 @@ F: drivers/misc/panel.c PARALLEL PORT SUBSYSTEM M: Sudip Mukherjee <[email protected]> -M: Sudip Mukherjee <[email protected]> +M: Sudip Mukherjee <[email protected]> L: [email protected] (subscribers-only) S: Maintained F: drivers/parport/
@@ -11096,7 +11096,7 @@ F: include/media/i2c/ov2659.h SILICON MOTION SM712 FRAME BUFFER DRIVER M: Sudip Mukherjee <[email protected]> M: Teddy Wang <[email protected]> -M: Sudip Mukherjee <[email protected]> +M: Sudip Mukherjee <[email protected]> L: [email protected] S: Maintained F: drivers/video/fbdev/sm712*
@@ -11513,7 +11513,7 @@ F: drivers/staging/rtl8712/ STAGING - SILICON MOTION SM750 FRAME BUFFER DRIVER M: Sudip Mukherjee <[email protected]> M: Teddy Wang <[email protected]> -M: Sudip Mukherjee <[email protected]> +M: Sudip Mukherjee <[email protected]> L: [email protected] S: Maintained F: drivers/staging/sm750fb/
Signature · 1 line
1.9.1
Sudip Mukherjee
maintainerPATCH 3/3 ppdev: use pr_* macros
In reply to Sudip MukherjeeThe coding style recommends not to use printk. Use pr_* macros.
Signed-off-by Sudip Mukherjee <[email protected]>
--- drivers/char/ppdev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/char/ppdev.c +5 -6
@@ -294,7 +294,7 @@ static int register_device(int minor, struct pp_struct *pp) port =parport_find_number (minor);if (!port) { -printk (KERN_WARNING "%s: no associated port!\n" , name); +pr_warn ("%s: no associated port!\n" , name);kfree (name);return -ENXIO ; }
@@ -308,7 +308,7 @@ static int register_device(int minor, struct pp_struct *pp)kfree (name);if (!pdev) { -printk (KERN_WARNING "%s: failed to register device!\n" , name); +pr_warn ("%s: failed to register device!\n" , name);return -ENXIO ; }
@@ -822,8 +822,7 @@ static int __init ppdev_init(void)int err =0 ;if (register_chrdev (PP_MAJOR ,CHRDEV , &pp_fops)) { - printk(KERN_WARNING CHRDEV ": unable to get major %d\n", - PP_MAJOR); +pr_warn (CHRDEV ": unable to get major %d\n" ,PP_MAJOR );return -EIO ; } ppdev_class =class_create (THIS_MODULE ,CHRDEV );
@@ -833,11 +832,11 @@ static int __init ppdev_init(void) } err =parport_register_driver (&pp_driver);if (err <0 ) { - printk(KERN_WARNING CHRDEV ": unable to register with parport\n"); +pr_warn (CHRDEV ": unable to register with parport\n" ); goto out_class; } - printk(KERN_INFO PP_VERSION "\n"); +pr_info (PP_VERSION "\n" ); goto out; out_class:
Signature · 1 line
1.9.1