Return-Path: From: Andrei Emeltchenko To: linux-bluetooth@vger.kernel.org Subject: [RFCv0 06/14] android/hal-sco: Check file descriptor >= 0 Date: Thu, 22 May 2014 15:05:59 +0300 Message-Id: <1400760367-24915-6-git-send-email-Andrei.Emeltchenko.news@gmail.com> In-Reply-To: <1400760367-24915-1-git-send-email-Andrei.Emeltchenko.news@gmail.com> References: <1400760367-24915-1-git-send-email-Andrei.Emeltchenko.news@gmail.com> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: From: Andrei Emeltchenko --- android/hal-sco.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/android/hal-sco.c b/android/hal-sco.c index 4ac5d00..e940547 100644 --- a/android/hal-sco.c +++ b/android/hal-sco.c @@ -710,11 +710,11 @@ static void sco_close_output_stream(struct audio_hw_device *dev, struct sco_dev *sco_dev = (struct sco_dev *) dev; struct sco_stream_out *out = (struct sco_stream_out *) stream_out; - DBG("dev %p stream %p fd %d", dev, stream_out, sco_dev->out->fd); + DBG("dev %p stream %p fd %d", dev, out, sco_dev->out->fd); - if (sco_dev->out && sco_dev->out->fd) { - close(sco_dev->out->fd); - sco_dev->out->fd = -1; + if (out && out->fd >= 0) { + close(out->fd); + out->fd = -1; } free(out->cache); -- 1.8.3.2