Skip to contentSkip to conversation

gpio-patchset-fixups: scx200 init undo malloc

PATCH New Jim Cromie 1 participant 1 message Jun 22, 2006

Subsystems (2)
lore
Share & tools
lore

Jim Cromie

author maintainer
#0 lore raw

PATCH 3/11 gpio-patchset-fixups: scx200 init undo malloc

If platform_device_add() fails, the add doesnt need to be undone. What is needed it to undo the previous malloc.

drivers/char/scx200_gpio.c +0 -0
diff -ruNp -X dontdiff -X exclude-diffs aa-2/drivers/char/scx200_gpio.c aa-3/drivers/char/scx200_gpio.c
@@ -91,7 +91,7 @@ static int __init scx200_gpio_init(void)
 
	rc = platform_device_add(pdev);
	if (rc)

- goto undo_platform_device_add;
+ goto undo_malloc;

	/* nsc_gpio uses dev_dbg(), so needs this */
	scx200_access.dev = &pdev->dev;
@@ -127,7 +127,8 @@ undo_chrdev_region:
	unregister_chrdev_region(dev, num_pins);
undo_platform_device_add:
	platform_device_put(pdev);
-	kfree(pdev);		/* undo platform_device_alloc */
+undo_malloc:
+	kfree(pdev);
	return rc;
}