summaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/berry_charge.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-08-23 15:55:34 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 14:55:20 -0700
commitfdf99c9ec10cb9cd44be3ac0bd007a49ac6dc751 (patch)
treea5d00a209e3f4e97c07c6927bdaa2f8257514648 /drivers/usb/misc/berry_charge.c
parent12943f097e5a4a0550f52f98ab8f476435e2ce15 (diff)
USB: fix memory leak in berry_charge driver
This fixes a small memory leak that happens every time the device is plugged in. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc/berry_charge.c')
-rw-r--r--drivers/usb/misc/berry_charge.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/misc/berry_charge.c b/drivers/usb/misc/berry_charge.c
index 92c1d2768df..24e2dc3148a 100644
--- a/drivers/usb/misc/berry_charge.c
+++ b/drivers/usb/misc/berry_charge.c
@@ -71,7 +71,7 @@ static int magic_charge(struct usb_device *udev)
if (retval != 2) {
dev_err(&udev->dev, "First magic command failed: %d.\n",
retval);
- return retval;
+ goto exit;
}
dbg(&udev->dev, "Sending second magic command\n");
@@ -80,7 +80,7 @@ static int magic_charge(struct usb_device *udev)
if (retval != 0) {
dev_err(&udev->dev, "Second magic command failed: %d.\n",
retval);
- return retval;
+ goto exit;
}
dbg(&udev->dev, "Calling set_configuration\n");
@@ -88,6 +88,8 @@ static int magic_charge(struct usb_device *udev)
if (retval)
dev_err(&udev->dev, "Set Configuration failed :%d.\n", retval);
+exit:
+ kfree(dummy_buffer);
return retval;
}
@@ -112,6 +114,7 @@ static int magic_dual_mode(struct usb_device *udev)
if (retval)
dev_err(&udev->dev, "Set Configuration failed :%d.\n", retval);
+ kfree(dummy_buffer);
return retval;
}