patch-2.3.27 linux/drivers/char/ppdev.c

Next file: linux/drivers/char/saa7121.h
Previous file: linux/drivers/char/pms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.26/linux/drivers/char/ppdev.c linux/drivers/char/ppdev.c
@@ -505,14 +505,14 @@
 	if (minor >= PARPORT_MAX)
 		return -ENXIO;
 
-	pp = kmalloc (GFP_KERNEL, sizeof (struct pp_struct));
+	pp = kmalloc (sizeof (struct pp_struct), GFP_KERNEL);
 	if (!pp)
 		return -ENOMEM;
 
-	memset (pp, 0, sizeof (struct pp_struct));
 	pp->state.mode = IEEE1284_MODE_COMPAT;
 	pp->state.phase = init_phase (pp->state.mode);
 	pp->flags = 0;
+	pp->irqresponse = 0;
 	atomic_set (&pp->irqc, 0);
 	init_waitqueue_head (&pp->irq_wait);
 
@@ -539,8 +539,9 @@
 	}
 
 	if (pp->pdev) {
+		const char *name = pp->pdev->name;
 		parport_unregister_device (pp->pdev);
-		kfree (pp->pdev->name);
+		kfree (name);
 		pp->pdev = NULL;
 		printk (KERN_DEBUG CHRDEV "%x: unregistered pardevice\n",
 			minor);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)