[PATCH]: usb: usb3503: fix memory leak in probe

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

 



Allocated hub is not freed on error in probe

Signed-off-by: Rahul Bedarkar <rahulbedarkar89@xxxxxxxxx>
---
usb3503.c |   18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

--- drivers/usb/misc/usb3503.c.orig 2013-08-03 13:23:41.000000000 +0530
+++ drivers/usb/misc/usb3503.c  2013-08-03 13:25:04.000000000 +0530
@@ -216,14 +216,20 @@
        }

        hub->gpio_intn  = of_get_named_gpio(np, "connect-gpios", 0);
-       if (hub->gpio_intn == -EPROBE_DEFER)
-           return -EPROBE_DEFER;
+       if (hub->gpio_intn == -EPROBE_DEFER) {
+           ret = EPROBE_DEFER;
+           goto err_out;
+       }
        hub->gpio_connect = of_get_named_gpio(np, "intn-gpios", 0);
-       if (hub->gpio_connect == -EPROBE_DEFER)
-           return -EPROBE_DEFER;
+       if (hub->gpio_connect == -EPROBE_DEFER) {
+           ret = EPROBE_DEFER;
+           goto err_out;
+       }
        hub->gpio_reset = of_get_named_gpio(np, "reset-gpios", 0);
-       if (hub->gpio_reset == -EPROBE_DEFER)
-           return -EPROBE_DEFER;
+       if (hub->gpio_reset == -EPROBE_DEFER) {
+           ret = EPROBE_DEFER;
+           goto err_out;
+       }
        of_property_read_u32(np, "initial-mode", &mode);
        hub->mode = mode;
    }
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux