From patchwork Mon Apr 29 13:29:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 163028 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp1888136ill; Mon, 29 Apr 2019 06:30:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyx9AwRS0sZo+kbQS7XeHdUnuHFt0jytzvMa0jcWCIq2lAzdFu8jBnLtfXQFee+90JTasgD X-Received: by 2002:a17:902:be12:: with SMTP id r18mr44580430pls.11.1556544619244; Mon, 29 Apr 2019 06:30:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556544619; cv=none; d=google.com; s=arc-20160816; b=VV6lE56ZgbQ7QoyecgE2ebW3bdIsmpkn5VURGU8Npueqq+AsA6Ks7OJ8+Iuz+KqQoh 6xChCFBg7BPDravwGP9ge76VAQQTXrmP3BSPp1kOjfAfWrvU5AnktlaSuJIR1Y6Nfvq5 rUOggvlS7fOKQI80j90adpTzcakxlNvFKg2ytiqluwHsCdWAea3QVUbvTu7NNSGMggEc dCPj6c+Y3DAer8ls12eUjY8I8pyTduf6kTMLAKIkrVe7fvDdngYSftBiGcpDNldBUEd1 lQae3j2jkxS7p0P0QYGmy66VhYsqEAz1+Zgn7Xo3ZcPonAobzI/Jurt92Pims966YdOO ZZYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jguxe++uQg1Tg16qsCOT2xdBZ2LoE15AQChE753+pog=; b=yD2H7ak+rIKEdnLaqc6PdIYr6g/u1CeCag8zTLgiZjr4xpeABsL5RBGrza8WJKdHLQ 2qQvG6Jm/gPvP+CTfqtYr6xlZgWnKfA1w+66cOT1ak3RDUBdktHS/7CzWdABXkKIB1e5 WwV0UKxPLHof4ObpX7oqkf24XF4bAWnw3bxwN6rvWoowWxm5AA0dXWYrcIngDqtEWiHs auevDnL6WaCmXBOrt9BGGAglkj19r//7ox4ieVBiADDYgsmxpnab158ZOIINkjStcAyY NzpiNrynXOBXAQDtB56bjBhYopsQRx963AiyOx4p5972nxQHp1+n4pZbALkVRDBwzt/y WPwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=ns9DV7vl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si33973639pgj.576.2019.04.29.06.30.18; Mon, 29 Apr 2019 06:30:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=ns9DV7vl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728319AbfD2NaR (ORCPT + 30 others); Mon, 29 Apr 2019 09:30:17 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55250 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725838AbfD2N3w (ORCPT ); Mon, 29 Apr 2019 09:29:52 -0400 Received: by mail-wm1-f68.google.com with SMTP id b10so759215wmj.4 for ; Mon, 29 Apr 2019 06:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jguxe++uQg1Tg16qsCOT2xdBZ2LoE15AQChE753+pog=; b=ns9DV7vl1GqOrO/l7Pw/dLmy4NgN3/x795IBIKZ+BKXrvNhko8jL+GoCk33SLpy7nF GphkEdLsA1stWrdCKWx20VUWt0I8WUBc+s7fvJgfBs1SeB61JEkA1oxNmTRIluXP87g5 xJtw8WLKxGjC2bFqvsAiFkZtMyKHE4MJdov2el5ZY2sbLNkl/K52f9Xitk383AEiq/Ht ZIIYkFr4XvTxV8WamLucfoPYlelow6AmwOej3EUaHz4AebYx52vKuwUdQyv+BoZTmUjB ndUGecFTHr8UYRamWk0vJP6sQLfC4pLm9TnIcemJ8aIKRqoZU3wZhZaghTXBIXLZc0sk BaSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jguxe++uQg1Tg16qsCOT2xdBZ2LoE15AQChE753+pog=; b=SWUAvLmJ1fwkwKz323uKIPJDnw906flAiERE+rRVeXoiThJ3ykeRkS9eCO67lad+M4 rwRjHQ9hUu24im5Qj7XWmKlTpA1mt4Gp0e55d36c0bLOPCTyLNHsMAgq8ULMnVUygT0b +cfE/AS6PU/qhXQiJ1zZ+VDTPiBgz57Lun/DksDDuSEV7shz+aA5iwyDGIiNIhu/t90f un0VT1RTHaq2bENTyTimq5X1WcVmTg15dHM2QXJz0SMICBy+5Umv+SuLnbwe8ZoLushw 0cIjOmp5aYqI82PMbS+Z6TZ6LkMlRdVWPK/GVUFWdzKHMbmB14xS8DPrSXTNdsPyRTOR 0KQg== X-Gm-Message-State: APjAAAVbduYZ8J6h4kbNQSFmYI6KdytoILkjYO2Vl6kXl/dYlPziGR21 YwTCalJp1VQnsqxCiRxsLELyGQ== X-Received: by 2002:a7b:ce84:: with SMTP id q4mr18135443wmj.41.1556544590406; Mon, 29 Apr 2019 06:29:50 -0700 (PDT) Received: from boomer.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id s17sm2857593wra.94.2019.04.29.06.29.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 06:29:49 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood Cc: Jerome Brunet , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, patchwork-bot+notify@kernel.org Subject: [PATCH 2/6] ASoC: hdmi-codec: unlock the device on startup errors Date: Mon, 29 Apr 2019 15:29:39 +0200 Message-Id: <20190429132943.16269-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190429132943.16269-1-jbrunet@baylibre.com> References: <20190429132943.16269-1-jbrunet@baylibre.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the hdmi codec startup fails, it should clear the current_substream pointer to free the device. This is properly done for the audio_startup() callback but for snd_pcm_hw_constraint_eld(). Make sure the pointer cleared if an error is reported. Signed-off-by: Jerome Brunet --- sound/soc/codecs/hdmi-codec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 9dca24732069..4bd598253c62 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -437,8 +437,12 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, if (!ret) { ret = snd_pcm_hw_constraint_eld(substream->runtime, hcp->eld); - if (ret) + if (ret) { + mutex_lock(&hcp->current_stream_lock); + hcp->current_stream = NULL; + mutex_unlock(&hcp->current_stream_lock); return ret; + } } /* Select chmap supported */ hdmi_codec_eld_chmap(hcp);