Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7751b42a authored by Manu Gautam's avatar Manu Gautam
Browse files

usb: gadget: audio: Don't attempt to close already closed files



Audio function driver (f_uac1.c) may call gaudio_cleanup back
to back without calling gaudio_setup. Handle this gracefully
by marking file pointer as NULL on file_close as gaudio_cleanup
routine already checks for NULL before file_close.

Change-Id: Ib6acb05578105d64cceaa766d0b0434d1a467c8f
Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
parent 0d7f1611
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -695,18 +695,24 @@ static int gaudio_close_snd_dev(struct gaudio *gau)
	pr_debug("Enter");
	/* Close control device */
	snd = &gau->control;
	if (snd->filp)
	if (snd->filp) {
		filp_close(snd->filp, NULL);
		snd->filp = NULL;
	}

	/* Close PCM playback device and setup substream */
	snd = &gau->playback;
	if (snd->filp)
	if (snd->filp) {
		filp_close(snd->filp, NULL);
		snd->filp = NULL;
	}

	/* Close PCM capture device and setup substream */
	snd = &gau->capture;
	if (snd->filp)
	if (snd->filp) {
		filp_close(snd->filp, NULL);
		snd->filp = NULL;
	}

	return 0;
}