drivers: uio: Only allocate new private data when probing device tree node
authorDamian Hobson-Garcia <dhobsong@igel.co.jp>
Fri, 16 Nov 2012 05:46:12 +0000 (14:46 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Nov 2012 21:44:10 +0000 (13:44 -0800)
The same condition should be used both when allocating and freeing the
driver private data.  When dev.of_node is non NULL, allocate a new
private data structure, otherwise use the values from the platform data.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Cc: "Hans J. Koch" <hjk@hansjkoch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/uio/uio_dmem_genirq.c
drivers/uio/uio_pdrv_genirq.c

index bbdf92559e3f4099ba3ea1115fd49023df13abd1..252434c9ea9d3c2aeb5d6c56ffb246603c3be383 100644 (file)
@@ -153,7 +153,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
        int ret = -EINVAL;
        int i;
 
-       if (!uioinfo) {
+       if (pdev->dev.of_node) {
                int irq;
 
                /* alloc uioinfo for one device */
index ac988ce62f2b11a7d89913a912f1e4b2a85dae16..c122bca669b6e58c77d30d07bbe9173fe546e8cb 100644 (file)
@@ -102,7 +102,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
        int ret = -EINVAL;
        int i;
 
-       if (!uioinfo) {
+       if (pdev->dev.of_node) {
                int irq;
 
                /* alloc uioinfo for one device */