Skip to content

Commit

Permalink
USB: fix memory leak in berry_charge driver
Browse files Browse the repository at this point in the history
This fixes a small memory leak that happens every time the device is
plugged in.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Greg Kroah-Hartman committed Oct 12, 2007
1 parent 12943f0 commit fdf99c9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/usb/misc/berry_charge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -80,14 +80,16 @@ 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");
retval = usb_driver_set_configuration(udev, 1);
if (retval)
dev_err(&udev->dev, "Set Configuration failed :%d.\n", retval);

exit:
kfree(dummy_buffer);
return retval;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit fdf99c9

Please sign in to comment.