From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796207759; b=k+aT0kg4/JrC78VnkaEJzuQ9EMOsoHKYSRNYnDaFw+iUQy4IG8Z6ew9XgeSxCecIgJab q/NQDUGZ5fYq7BZRrmqAX91e0/CVivUjm84y40z7nkHxt0wRZTXx3sDOrAdE9aYr0RUUh adTRs5hfyY+l2vlqzpIfALLVu/T5oAiWMS3jp/wztsZCMozpqvjCjX93VNjxpO/2tyb1v /WfZSa9+Nn08ZjQdDJKQ7FLdhsj6xZ8PKUKJC1xzbkx28pIrdMk6EvpXOdJS7cZHFcO7L /SZJoji/9Rm687G2YZ7uJEMsJQGFK7z8Tjiu6WuSmIT3eXPmEXIhWqSojt0f5lOPlWA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796207759; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=81kQFUPemk3+aXBlvz95dlCCQrkQWpSyKEbSeKXHJcI=; b=MGumaLpqTQ2vsArSRd2LY9APsDuFcDCU/M4haBoKjhzccQnr+aZOzhcwJg2e3QcpUIGR X8Wpm2/wiPtgZTr2zG6XzUnHJbvaZACLbEmQEK5+eA3fe5fXGKeRyq+enODCFv6BnKPAN VqxHY2PXgR7xI7TjFIyz/C5O5uzMwoXlxV4ORSLzZXN2LiTt3sRMLGNxsZ2bp78Gxex1V TnchxhvtOfLCsGhRWa8KzP8R6adxbfpys8qC43G1Ifzk+0d0vWipeVC6A81Vo8Wvma1C0 bQ4u37FSP2H8Un9CuSqkMXdVA0KY2ZgqsxhA3OdogMT4dQ7LNPIhuaPbcCptXHZHrBA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Ybxq6Ykl; arc=none smtp.remote-ip=74.125.82.50 Received: from mail-dl1-f50.google.com (mail-dl1-f50.google.com [74.125.82.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A6C0606A32E for ; Wed, 2 Dec 2026 10:35:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2A6C0606A32E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Ybxq6Ykl Received: by mail-dl1-f50.google.com with SMTP id a92af1059eb24-15ea896ddc8so20921457c88.0 for ; Wed, 02 Dec 2026 02:35:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796207758; x=1796812558; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=81kQFUPemk3+aXBlvz95dlCCQrkQWpSyKEbSeKXHJcI=; b=Ybxq6YklaULXJ4Ww8pqNoT9dSewAyA30wAjo/7mDRx9MCEXcTABqU3MjnRkvhsZs1u LBcKF7a+x8dggJMGSo5pPcddfCD08vTRnPEujblhmjKM7dThj0QCbWuC4GCJUGVthYSw vWkrSO4Vfut/ARLWzRzTdTilrkKoTyBKSuc6PcnJXOhtAEjogrhNmgD39AwmTu0w6RbV 8O6avg9xomkEa9rIvOqbCx4sXbPfgXjzOnvKt8X+6Gwn1LUbrYxZBLOu0YEW6ZTEO4XT nCBcTdvWC/giI6FhfDLL3XGMFtXJv59SUSjRld9D7jxKgaky5ZVwha08JmpLPa8ViuEk v2iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796207758; x=1796812558; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=81kQFUPemk3+aXBlvz95dlCCQrkQWpSyKEbSeKXHJcI=; b=qERWWBqlvB0set2aI5vgPD/RknDR1M+KZaopZxupTwt7CBa1pGdXFUsxfgVefYIlCW 26XKwgERneeaDMuTZsD+Picg+5iEFVdAejAxBUYEbXhoenDNrNNJFnZ2qvQnEEqA/52Y Zb8zSn0G7146ISYM9SFSziC9K/iK/dhwf0862rbOaX8DVN+TdpFiBKYWYpTvZ4mgyVes EdUmV97rbh329mh7574FH0uYA4eRC4urQGnIHfaIn9ALAQ0fsW1N29Oyv3gSx6q3/3x/ 4IW69ge1iVhF1ICwo/y/ODD0AzlwK0nb33oHPrIM1/qpYu8MB03Q/8tM1/SXk8QlNUkN aZWQ== X-Forwarded-Encrypted: i=1; AL+hErH+LX/r++hd29c/aiC5BsdK8o2ajafUwAw7f6eqGALrM9bmEqnQ4gvIgtwjvD4QIj9HJAYUT1VgR5gtMT4=@vger.kernel.org X-Gm-Message-State: APuU4Z+BI3ITETzhzqimhJ35JFN6n8KrcJWW4ohU3RWQpz2Wb8UCLI9u D7EolBD/3doiZjQWV7WV+0XtsP4W27XLnaE5pY1QNBPETlEkBjpT4TQY X-Gm-Gg: AZFdTZd9Mqm2IMo22pFhbLTgmfBMx4TOi6uZKyVY2mxTZWpRXGcfomkjO6eqG36mdKS ROloeHChAy5F38xyG6VuFaLnX44E84JGi9AWDFqiXeNuVJP87LPNCoP3Lk5eI9QFze+qXzyvGpD R8SUFDIty3C0PSFgpoZ6qTwOLDCmWicSvz89g6pmUXcjss1mOJtK8ZBGinJS2cV/I+ov/T1EjNj FJ2UucJFN3AZUtg8XG8nY7MfHaBpM3U+NqU7dpkK3AyGZD+IJ/5oHB38jvcGICwWs0xOVJvnDFq CCY2hekDH1Be56GP8hpjtHKskdqkvCVEs0NSdWDI60YCxgVjk8L55d5e7DuYkSS5+d3b4tV5/s2 1F07VjyrkhMdNlE+i01Jp0e21lBIHZyUd9Mpl3ySA5vEKqA+u6kD8J1Hnk+bO/iMJNIqtN6Qruq igFcROrZ4Z1uGoysaiCPk0LGa9Vo3jB+zf/sUpgtKSY18nXuf6SJI1y1cJDxUI8TesdstECcAqc NR9S0+yJAC9VSQR7icUVWTXhqAez8YCh+E/neqpbJVks30avWA8vFoIs8Bu/6dTW5k0ONR//xqh 0Zb7RgsjWu7pfF+9h/Zb6WsRxtFZKzoKDJQXImPhC/wQhGbVUveP X-Received: by 2002:a05:7022:b056:20b0:1b3:ac53:da84 with SMTP id a92af1059eb24-1b5568e371bmr42767760c88.32.1796207758214; Wed, 02 Dec 2026 02:35:58 -0800 (PST) Received: from localhost.localdomain ([103.177.252.234]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b556829d31sm150885334c88.9.2026.12.02.02.35.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 02:35:57 -0800 (PST) From: Sreeraj S Kurup To: sreekuttan2156239@gmail.com, cix-kernel-upstream@cixtech.com, fugang.duan@cixtech.com, gary.yang@cixtech.com, perex@perex.cz, tiwai@suse.de Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH v3] ALSA: hda: cix-ipbloq: Fix runtime PM handling on probe failure Date: Wed, 2 Dec 2026 10:35:18 +0000 Message-ID: <20261202103518.4945-1-sreekuttan2156239@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261202094026.4432-1-sreekuttan2156239@gmail.com> References: <20261202094026.4432-1-sreekuttan2156239@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The driver enables runtime PM before calling pm_runtime_resume_and_get(). If cix_ipbloq_hda_init() or cix_ipbloq_hda_probe_codec() fails, the runtime PM usage reference must be released. However, calling pm_runtime_put_sync() before freeing the ALSA device can trigger runtime suspend and disable the controller clocks. The ALSA device cleanup may then access controller registers while the clocks are disabled. Disable runtime PM first and keep the controller clocks enabled while freeing the ALSA device and card. Then balance the runtime PM reference without triggering runtime suspend and disable the clocks explicitly. Also disable runtime PM if pm_runtime_resume_and_get() fails. Fixes: d91e9bd10125 ("ALSA: hda: add CIX IPBLOQ HDA controller support") Signed-off-by: Sreeraj S Kurup --- v3: - Add the missing changelog for v2. v2: - Fix runtime PM cleanup ordering to avoid unclocked MMIO accesses during ALSA device cleanup. - Balance the runtime PM reference using pm_runtime_put_noidle() after freeing the ALSA device and card. - Keep controller clocks enabled during ALSA cleanup and disable them afterward. - Handle runtime PM cleanup when pm_runtime_resume_and_get() fails. sound/hda/controllers/cix-ipbloq.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/sound/hda/controllers/cix-ipbloq.c b/sound/hda/controllers/cix-ipbloq.c index f73d6216bce3..10ae8729c312 100644 --- a/sound/hda/controllers/cix-ipbloq.c +++ b/sound/hda/controllers/cix-ipbloq.c @@ -237,6 +237,7 @@ static int cix_ipbloq_hda_probe(struct platform_device *pdev) struct cix_ipbloq_hda *hda; struct snd_card *card; struct azx *chip; + bool pm_ref = false; int err; hda = devm_kzalloc_obj(&pdev->dev, *hda); @@ -284,21 +285,37 @@ static int cix_ipbloq_hda_probe(struct platform_device *pdev) err = pm_runtime_resume_and_get(hda->dev); if (err < 0) { dev_err(hda->dev, "runtime resume and get failed, err = %d\n", err); - goto out_free_device; + goto out_pm_disable; } + pm_ref = true; + err = cix_ipbloq_hda_init(hda, chip, pdev); if (err < 0) - goto out_free_device; + goto out_pm_cleanup; err = cix_ipbloq_hda_probe_codec(hda); if (err < 0) - goto out_free_device; + goto out_pm_cleanup; pm_runtime_put(hda->dev); return 0; +out_pm_cleanup: + pm_runtime_disable(hda->dev); + snd_device_free(card, chip); + snd_card_free(card); + if (pm_ref) { + pm_runtime_put_noidle(hda->dev); + clk_bulk_disable_unprepare(hda->nclocks, hda->clocks); + } + return err; + +out_pm_disable: + pm_runtime_disable(hda->dev); + goto out_free_device; + out_free_device: snd_device_free(card, chip); out_free_card: -- 2.55.0