From patchwork Sun Aug 20 17:26:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13358854 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6CD66EE4993 for ; Sun, 20 Aug 2023 17:28:32 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id F066883B; Sun, 20 Aug 2023 19:27:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F066883B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1692552510; bh=jsD5uI4S3o2jUeGa6u2zZUzzFvvv2Nl1r8lUk1qLTnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=MakXnATUzQRr4IfKIhsdDo0h3yPpjnAlJJLTsLgZQ2sJTrBrZD9/V2vH6RkzXBrMl qD+9Tx66tC93L5hW1+5XPAr6pjdrCVbomsr3tMJXrUaEx5/TFPM0R5JwqTM9XUIJst ioRhnSYuCiOQfFzejCR8MH07hZ1pnxnvJmUUbP94= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C8274F80551; Sun, 20 Aug 2023 19:26:50 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 53A74F80551; Sun, 20 Aug 2023 19:26:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 51A87F80199; Sun, 20 Aug 2023 19:26:46 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id F0A2CF800D1 for ; Sun, 20 Aug 2023 19:26:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F0A2CF800D1 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=uDpB2kYN; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=4ZztF9Vj Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6118421EAB; Sun, 20 Aug 2023 17:26:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1692552400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YPw/LWg5iwEjyRxxClz2i3m1RrPEm4Uj3Lk5CoF21r0=; b=uDpB2kYNJVU4eq4dePGOMXyeZIAHzfouhosTeB1ko39J+T4cp1WWiV4MB7mE+k7HX7C8Nn QHYHwMBqfUJhR9G0TFvNtH//QereHs4WXzONe2PWbDrA9KnOsXByXX1fbGkav1fxbn5p0t pCeVkIhnGVxQl4fG5a17hsICUYoh4Js= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1692552400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YPw/LWg5iwEjyRxxClz2i3m1RrPEm4Uj3Lk5CoF21r0=; b=4ZztF9VjTnOZm1umoElYu6xsWVX5Wvj06Gp8xVOM+wql7skkMRPTKlVIPgno1VfKGA7mvN 3TnHxY8hOZ7F4sAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3ADAC133F7; Sun, 20 Aug 2023 17:26:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id MLl3DdBM4mTjZgAAMHmgww (envelope-from ); Sun, 20 Aug 2023 17:26:40 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Pierre-Louis Bossart , Shenghao Ding Subject: [PATCH 2/2] ALSA: hda/tas2781: Fix PM refcount unbalance at tas2781_hda_bind() Date: Sun, 20 Aug 2023 19:26:35 +0200 Message-Id: <20230820172635.22236-2-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230820172635.22236-1-tiwai@suse.de> References: <20230820172635.22236-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: DKP4VBMW3N4A4LGYG5EBYUAJ2Y4M2TH2 X-Message-ID-Hash: DKP4VBMW3N4A4LGYG5EBYUAJ2Y4M2TH2 X-MailFrom: tiwai@suse.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The error path of tas2781_hda_bind() needs to release PM refcount as well. Modify the code flow to handle properly. Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver") Reported-by: Pierre-Louis Bossart Closes: https://lore.kernel.org/r/9f910785-e856-1539-e3e4-c9817af5fe67@linux.intel.com Signed-off-by: Takashi Iwai --- sound/pci/hda/tas2781_hda_i2c.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c index 0968ae915fd0..aa9ce3837336 100644 --- a/sound/pci/hda/tas2781_hda_i2c.c +++ b/sound/pci/hda/tas2781_hda_i2c.c @@ -608,15 +608,13 @@ static int tas2781_hda_bind(struct device *dev, struct device *master, strscpy(comps->name, dev_name(dev), sizeof(comps->name)); ret = tascodec_init(tas_priv, codec, tasdev_fw_ready); - if (ret) - return ret; - - comps->playback_hook = tas2781_hda_playback_hook; + if (!ret) + comps->playback_hook = tas2781_hda_playback_hook; pm_runtime_mark_last_busy(dev); pm_runtime_put_autosuspend(dev); - return 0; + return ret; } static void tas2781_hda_unbind(struct device *dev,