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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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 <[email protected]>

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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux