diff mbox

[11/15] ALSA: line6: Only free buffer if it is set.

Message ID 1470942147-19848-12-git-send-email-dev@andree.sk (mailing list archive)
State New, archived
Headers show

Commit Message

Andrej Krutak Aug. 11, 2016, 7:02 p.m. UTC
This makes the resource freeing not dependent on the existence of private data
from the podhd module, which may be gone during the call.

Signed-off-by: Andrej Krutak <dev@andree.sk>
---
 sound/usb/line6/driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Takashi Iwai Aug. 12, 2016, 8:45 a.m. UTC | #1
On Thu, 11 Aug 2016 21:02:23 +0200,
Andrej Krutak wrote:
> 
> This makes the resource freeing not dependent on the existence of private data
> from the podhd module, which may be gone during the call.
> 
> Signed-off-by: Andrej Krutak <dev@andree.sk>

Should be merged to patch 9 from the beginning.


Takashi
diff mbox

Patch

diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index 344465f..142e0e3 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -479,13 +479,14 @@  static void line6_destruct(struct snd_card *card)
 	struct usb_device *usbdev = line6->usbdev;
 
 	/* free buffer memory first: */
-	if (line6->properties->capabilities & LINE6_CAP_CONTROL_MIDI)
+	if (line6->buffer_message)
 		kfree(line6->buffer_message);
 
 	kfree(line6->buffer_listen);
 
 	/* then free URBs: */
 	usb_free_urb(line6->urb_listen);
+	line6->urb_listen = NULL;
 
 	/* decrement reference counters: */
 	usb_put_dev(usbdev);