From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795017138; b=OjtS6D/LK0qFNwhQqW+Vx8lmDnTvYdXr6tbK6I99GtY75MTSLUocdb7Gy4u/CSI62QmT 5L9hyznW1ilDHHa7hcBVCgd5gf3bpq9hWohDskGPt7FbgQM27R9QWLXLioYXoufO8fCVG UvCc84SNYRaVt15jyPYDMQ6UvgMk+hTU4gqP61FgNtKuluV/II3+MJlpDFh4yrRcRkicr Xez0a3aF0lJvTwQUAx6d3SQVEjUvAkmWx9D8htn9Ea/8Ils7d0/rVDXTR2DOZ/ZGjYQ/o blpMQk+9qao0joeq4ftJzi8ix0t515AYB2xzlZcWRknnx1Uav+WjKLlf9T1LfzjkSnQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795017138; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=SuRjaTEew78QWcZ+PVMrGojUzRRgvEwxEOSqmeVn0Gw=; b=kQ5uD2zoMPH57p9GIp/5AEBJ4+dKQ2tTBZR8uzkAnGnMa9rIAvAMY6brnewUE3MjaITI e8HhPCtWyyvb7Uq6OFwdwQJ5JZRswUuieGARO0hny3/FCm+3cAf79Iwmqzas2qd/QNxyV i7oSgOVl/aITjmR+4LMVmEY92N2rgslD4uorwE+nManE7tE/CQxLsTrPOk2pjud+y6wB3 ThIdaHS4xZcb/QrJAjpeU00edh0pKp3YpgGYSXwcdv8jkW9WFXhUHmXeYTv98c8DWOWnh yDNMapv1YBSwrF7XRImlA9TB45fDoXRku1R0qs1G0LPck5y58lA7FPgPACMPPMRft1w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Rm6i89P8; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E92AA606A31C; Wed, 18 Nov 2026 15:52:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Rm6i89P8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 490241F000C4; Wed, 18 Nov 2026 15:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795017137; bh=SuRjaTEew78QWcZ+PVMrGojUzRRgvEwxEOSqmeVn0Gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Rm6i89P85wAtp3TX+fWiqnc0mr0eVlO63rztP5DUTPs+96TiLPpapzVNuGqWtM5jD ucSGaxUNIZYZcdTHzZqq6fqsQv21j3a7+2p6HqvE/BpnVU49JEGodOX4NQtHN3B4wM X1YS/KekBxl2La6vyxHQuj/TZqmyW9u5sQP2R3+Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ijae Kim , Myeonghun Pak , Lee Jones , Sasha Levin Subject: [PATCH 7.3 0775/2651] mfd: da9150: Balance IRQ wake on teardown Date: Wed, 18 Nov 2026 15:33:35 +0100 Message-ID: <20261118150315.790288207@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150247.972732815@linuxfoundation.org> References: <20261118150247.972732815@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@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 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Myeonghun Pak [ Upstream commit ef464f82f3aecad4071af71074b2ceb77ffbb609 ] DA9150 enables IRQ wake after registering its regmap IRQ chip, but does not disable it on a later probe failure or driver removal. This leaves the wake depth elevated after the handler is removed, and repeated bind attempts can accumulate the imbalance. Remember whether enabling IRQ wake succeeded and balance only a successful call. Remove MFD children first so their nested IRQ users are gone, then disable wake before removing the regmap IRQ chip. Preserve the existing non-fatal behavior when IRQ wake cannot be enabled. This issue was identified during our ongoing static-analysis research while reviewing kernel code. Fixes: b8fce55c09d3 ("mfd: Add support for DA9150 combined charger & fuel-gauge device") Assisted-by: LLM Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak Link: https://patch.msgid.link/20260923021936.957065-1-mhun512@gmail.com Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/da9150-core.c | 8 ++++++-- include/linux/mfd/da9150/core.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/da9150-core.c b/drivers/mfd/da9150-core.c index 5c59cc869fb3e..19325d72a27e7 100644 --- a/drivers/mfd/da9150-core.c +++ b/drivers/mfd/da9150-core.c @@ -450,7 +450,7 @@ static int da9150_probe(struct i2c_client *client) da9150->irq_base = regmap_irq_chip_get_base(da9150->regmap_irq_data); - enable_irq_wake(da9150->irq); + da9150->irq_wake_enabled = !enable_irq_wake(da9150->irq); ret = mfd_add_devices(da9150->dev, -1, da9150_devs, ARRAY_SIZE(da9150_devs), NULL, @@ -463,6 +463,8 @@ static int da9150_probe(struct i2c_client *client) return 0; mfd_fail: + if (da9150->irq_wake_enabled) + disable_irq_wake(da9150->irq); regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data); regmap_irq_fail: i2c_unregister_device(da9150->core_qif); @@ -474,8 +476,10 @@ static void da9150_remove(struct i2c_client *client) { struct da9150 *da9150 = i2c_get_clientdata(client); - regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data); mfd_remove_devices(da9150->dev); + if (da9150->irq_wake_enabled) + disable_irq_wake(da9150->irq); + regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data); i2c_unregister_device(da9150->core_qif); } diff --git a/include/linux/mfd/da9150/core.h b/include/linux/mfd/da9150/core.h index d116d5f3ef561..369698036d1aa 100644 --- a/include/linux/mfd/da9150/core.h +++ b/include/linux/mfd/da9150/core.h @@ -65,6 +65,7 @@ struct da9150 { struct regmap_irq_chip_data *regmap_irq_data; int irq; int irq_base; + bool irq_wake_enabled; }; /* Device I/O - Query Interface for FG and standard register access */ -- 2.53.0