[ patch -mm1 03/11 ] gpio-patchset-fixups: scx200 init undo malloc

From: Jim Cromie
Date: Thu Jun 22 2006 - 14:49:35 EST



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

Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>

diff -ruNp -X dontdiff -X exclude-diffs aa-2/drivers/char/scx200_gpio.c aa-3/drivers/char/scx200_gpio.c
--- aa-2/drivers/char/scx200_gpio.c 2006-06-22 09:43:16.000000000 -0600
+++ aa-3/drivers/char/scx200_gpio.c 2006-06-22 09:30:20.000000000 -0600
@@ -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;
}



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/