From nobody Sat Sep 26 06:24:22 2026 Received: from mx.prosyst.ru (m2.prosoftsystems.ru [46.48.77.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C1D9396572; Fri, 4 Sep 2026 06:49:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.48.77.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788504601; cv=none; b=TlaPsqOUCWDxDp5Iw0o/KWXat2kjdw0JQIeUo93Qoo8a45Y4Ed+X2biiGl4FBuYHY6BrhkhO5R3mSDIydmW7bN+xEHS+zSUzeUNBvjV77GzOGwh9uReI4lLu9SxHp+ogOqPr8ohJgD9W1qQZtvLHkvIROGAgHppu9wsuGivulo8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788504601; c=relaxed/simple; bh=xvZeHBDKdV6/TZSpNv5Ns7nmBbj3y9I6Bif9TWMVti4=; h=Content-Type:From:To:CC:Subject:Date:Message-ID:References: In-Reply-To:MIME-Version; b=l+JcgLuM4sZO8xnYMCp8mkeTZSXSpuaUYV56pqJMSyJEHHfPjgSnm8rF2QMUtHtKnnrMM/azMSIf7h+0QI7Ornawsq4gmuxKDBwEyihetr9+7uDPZVSCSvtBRSkgQqamLVSZF/TfkWeRiPnV3o2zI8gkH0RrweJkOVJ2DHst4Uc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=prosoftsystems.ru; spf=pass smtp.mailfrom=prosoftsystems.ru; dkim=pass (2048-bit key) header.d=prosoftsystems.ru header.i=@prosoftsystems.ru header.b=qMYl40ts; arc=none smtp.client-ip=46.48.77.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=prosoftsystems.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=prosoftsystems.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=prosoftsystems.ru header.i=@prosoftsystems.ru header.b="qMYl40ts" Content-Language: ru-RU Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; d=prosoftsystems.ru; s=ps; c=relaxed/relaxed; t=1788503688; h=from:to:date:message-id:subject; bh=ngNsvu/evNzZxw5zWOYO9JfbmAS0BwgmROUZjM7iK/I=; b=qMYl40tszCO9liF9sgqEirGtQGtXtVXWH4SJ1XyvLzFK5DiFJXL8G3k7v3vT7mb6CEUmnvPou9U gSDQdpmPsAjkyCqcoRTouf7tMmrPOpID/TpF7OjabbVKluXuEHvG+HqWnA4WsRTKqcuhG/7awCO94 udZluzXaLsT8Fws5J7YmBR+zpgcXE0Bu2N6z8L2QLbF5q7GhDKxhjA4VcIhSd97fMoWhUrHi8WYs9 ZcJdqT5hFDUSQtv+sV8IDE8n+sLisaAoQy7+7fw62wdIqYw3/WIAn57sSJNkbjSPLf7XKNDeEaNgO D5gfPY12S8fFoCK+wSfEidEAhrmlanT2l0CQ== Received: from echo-2.prosoft.ural.ru (172.21.245.22) by mx.prosoftsystems.ru (172.21.240.33) with Microsoft SMTP Server (TLS) id 15.1.396.30; Fri, 4 Sep 2026 11:34:48 +0500 Received: from echo-2.prosoft.ural.ru (172.21.245.22) by echo-2.prosoft.ural.ru (172.21.245.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.39; Fri, 4 Sep 2026 11:34:48 +0500 Received: from echo-2.prosoft.ural.ru ([fe80::8f12:4f85:56d8:13ed]) by echo-2.prosoft.ural.ru ([fe80::8f12:4f85:56d8:13ed%17]) with mapi id 15.02.1748.039; Fri, 4 Sep 2026 11:34:48 +0500 From: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= To: Aaro Koskinen CC: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= , Andreas Kemnade , Kevin Hilman , Roger Quadros , "Tony Lindgren" , Lee Jones , Marcin Niestroj , Grygorii Strashko , "linux-omap@vger.kernel.org" , "mfd@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" , "stable@vger.kernel.org" Subject: [PATCH v3 1/3] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure Thread-Topic: [PATCH v3 1/3] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure Thread-Index: AQHdPDd7F9hvd/831ECQWCXVj/bP8g== Date: Fri, 4 Sep 2026 06:34:48 +0000 Message-ID: <20260904063439.69881-2-r.zhambakiev@prosoftsystems.ru> References: <20260904063439.69881-1-r.zhambakiev@prosoftsystems.ru> In-Reply-To: <20260904063439.69881-1-r.zhambakiev@prosoftsystems.ru> Accept-Language: ru-RU, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Radiy Zhambakiev tps65217_probe() ignores the return value of tps65217_irq_init(), so when the irq domain creation fails the probe still completes and the driver ends up bound with a NULL tps->irq_domain. Unloading the module then makes tps65217_remove() call irq_domain_remove() on the NULL pointer and oops the kernel. On top of that, irq_find_mapping() may fall back to the default irq domain and dispose of mappings that belong to other interrupt controllers. Check the return value and abort the probe on failure so the error is reported and no inconsistent state is left for removal. Fixes: 6556bdacf646fcaa ("mfd: tps65217: Add support for IRQs") Cc: stable@vger.kernel.org Signed-off-by: Radiy Zhambakiev --- drivers/mfd/tps65217.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index c240fac0ede7..2d04d9e0ae29 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -333,7 +333,9 @@ static int tps65217_probe(struct i2c_client *client) } =20 if (client->irq) { - tps65217_irq_init(tps, client->irq); + ret =3D tps65217_irq_init(tps, client->irq); + if (ret) + return ret; } else { int i; =20 --=20 2.55.0 From nobody Sat Sep 26 06:24:22 2026 Received: from mx.prosyst.ru (m2.prosoftsystems.ru [46.48.77.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C121F376BC1; Fri, 4 Sep 2026 06:50:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.48.77.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788504606; cv=none; b=mypY2QjXxBYfwe5SX62P0XY5hh/IiZfFNyOHzD54LbdideYZ8JXTiDPPUTbd9H/M9Rv4XZDfImoi8R+Yyxb3REu3bh8IpGbyNIS/WuTYgms+zRu9i3S1hvJ4hlIKxE+CD6VaJ7xI+G0LctxpqIVwXVoc8noC23MdDxvYXlFIZ/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788504606; c=relaxed/simple; bh=XG8zevKKubilijGzARFrK+wZJ1uU9YsdUIYe59odJps=; h=Content-Type:From:To:CC:Subject:Date:Message-ID:References: In-Reply-To:MIME-Version; b=S2EJ/jHopPAqKdc/N/QQ0Hv9RmdRaAfD26P3qU8rHdkpvZ8HjvYLQc4UZdfAXLLw7wkpvQzM0/SHgn/jFvjiQaTPLPfwUfVbRiHd+YBBApYedtnCQ/VeMlFgI2nOsioLX0bdWOfoHR4xHORm+gGpicmzd/d9/J0L4Ilk7Zh7s/4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=prosoftsystems.ru; spf=pass smtp.mailfrom=prosoftsystems.ru; dkim=pass (2048-bit key) header.d=prosoftsystems.ru header.i=@prosoftsystems.ru header.b=XsGnl3xa; arc=none smtp.client-ip=46.48.77.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=prosoftsystems.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=prosoftsystems.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=prosoftsystems.ru header.i=@prosoftsystems.ru header.b="XsGnl3xa" Content-Language: ru-RU Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; d=prosoftsystems.ru; s=ps; c=relaxed/relaxed; t=1788503689; h=from:to:date:message-id:subject; bh=TF7TNrOM0H21WevzHpDbSS/wqGFD8yi5wizZnlHpXCQ=; b=XsGnl3xaywfNZwxCUgyL3M4v/zaVWhO1Y5LbmUlC0BTvmToGG38E9jmeFI3npmbhI1UTruSkNSH VUTgh5SkSM0j42J5oeIwUS8MFEIqXAd6XLpnD9iWG9taTJ0oCTLtVikMWjqWE2cPq1AIchVNrFlnW U5PiZCf3ZP4JVzCYOfGr3i5VbM1hhF3eCpqmc/7c73JnwKkRpwNeE42Xv/rfPC0jQ74R0nuw2UeZd 3uTqDWPIuJy7+2eFcvCQXm4IdcPrBuHKrndBY/JhxW7VdCOuda3twgBynbjySYZIl/0Ehwz8XEAjH /FkHMQ+TIvK6EMIGRugs1KUDf8/h1ar0Jm5g== Received: from echo-2.prosoft.ural.ru (172.21.245.22) by mx.prosoftsystems.ru (172.21.240.33) with Microsoft SMTP Server (TLS) id 15.1.396.30; Fri, 4 Sep 2026 11:34:49 +0500 Received: from echo-2.prosoft.ural.ru (172.21.245.22) by echo-2.prosoft.ural.ru (172.21.245.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.39; Fri, 4 Sep 2026 11:34:49 +0500 Received: from echo-2.prosoft.ural.ru ([fe80::8f12:4f85:56d8:13ed]) by echo-2.prosoft.ural.ru ([fe80::8f12:4f85:56d8:13ed%17]) with mapi id 15.02.1748.039; Fri, 4 Sep 2026 11:34:49 +0500 From: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= To: Aaro Koskinen CC: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= , Andreas Kemnade , Kevin Hilman , Roger Quadros , "Tony Lindgren" , Lee Jones , Marcin Niestroj , Grygorii Strashko , "linux-omap@vger.kernel.org" , "mfd@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" , "stable@vger.kernel.org" Subject: [PATCH v3 2/3] mfd: tps65217: Check return value when masking interrupt sources Thread-Topic: [PATCH v3 2/3] mfd: tps65217: Check return value when masking interrupt sources Thread-Index: AQHdPDd8bCcAcABogkaeMpPT11PJfA== Date: Fri, 4 Sep 2026 06:34:49 +0000 Message-ID: <20260904063439.69881-3-r.zhambakiev@prosoftsystems.ru> References: <20260904063439.69881-1-r.zhambakiev@prosoftsystems.ru> In-Reply-To: <20260904063439.69881-1-r.zhambakiev@prosoftsystems.ru> Accept-Language: ru-RU, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Radiy Zhambakiev tps65217_irq_init() ignores the error returned by tps65217_set_bits() when masking all interrupt sources. A failed register write leaves the driver's software mask out of sync with the hardware and may result in spurious interrupts. Check the return value and propagate the error to the caller. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 6556bdacf646fcaa ("mfd: tps65217: Add support for IRQs") Cc: stable@vger.kernel.org Signed-off-by: Radiy Zhambakiev --- drivers/mfd/tps65217.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index 2d04d9e0ae29..9a1528456ffc 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -155,8 +155,13 @@ static int tps65217_irq_init(struct tps65217 *tps, int= irq) =20 /* Mask all interrupt sources */ tps->irq_mask =3D TPS65217_INT_MASK; - tps65217_set_bits(tps, TPS65217_REG_INT, TPS65217_INT_MASK, - TPS65217_INT_MASK, TPS65217_PROTECT_NONE); + ret =3D tps65217_set_bits(tps, TPS65217_REG_INT, TPS65217_INT_MASK, + TPS65217_INT_MASK, TPS65217_PROTECT_NONE); + if (ret) { + dev_err(tps->dev, "Failed to mask interrupt sources: %d\n", + ret); + return ret; + } =20 tps->irq_domain =3D irq_domain_create_linear(dev_fwnode(tps->dev), TPS652= 17_NUM_IRQ, &tps65217_irq_domain_ops, tps); --=20 2.55.0 From nobody Sat Sep 26 06:24:22 2026 Received: from mx.prosyst.ru (m2.prosoftsystems.ru [46.48.77.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF83B357CFE; Fri, 4 Sep 2026 06:36:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.48.77.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788503767; cv=none; b=aoQJDAbqfIJR3tJygyFB/PToPtrK3mhAFtkFPtF81BVraidfpnueE6tw3WJy4d4J9yhCdt7iGTai5Cnc6XqkiraGuzFEczrFH5ZjnfEE0Z5wLBo8oylE6IGFAFYPy96Kp1m+8fYpGMbju4Un3VsG3/kwgiTQ5HU5TDAh1okJ3Ag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788503767; c=relaxed/simple; bh=Sr5z2khyE7oxPP8N1SJ67rnrsXky8jvMj7M8fTXvjgM=; h=Content-Type:From:To:CC:Subject:Date:Message-ID:References: In-Reply-To:MIME-Version; b=IBb3QvOjTkOflSjCmDWsCZ/Gbo/4RzTptI6Pu8tB5aMf17SQuO3DAav5y8Lx51F7O6HwVXDHnGKY6Q6w8i70JtYBZATXtsLsq3Jd80xKTGK1OmXRwFby+74mNgW+vDb6ITymu4ekMs4NSZoZKgOI6oc8DG2bxWXW4UrGtVkY5jc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=prosoftsystems.ru; spf=pass smtp.mailfrom=prosoftsystems.ru; dkim=pass (2048-bit key) header.d=prosoftsystems.ru header.i=@prosoftsystems.ru header.b=aFySTzou; arc=none smtp.client-ip=46.48.77.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=prosoftsystems.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=prosoftsystems.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=prosoftsystems.ru header.i=@prosoftsystems.ru header.b="aFySTzou" Content-Language: ru-RU Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; d=prosoftsystems.ru; s=ps; c=relaxed/relaxed; t=1788503692; h=from:to:date:message-id:subject; bh=Xb2AMWxTPtB43313I9f0fpt4Huw3RGfytDf9R/zyYIc=; b=aFySTzouKlw4mOWq9su+gnpjGu+jnbl3OSMkYI/CSSQMXyQequHRX8VpVoOWBxpUTPLS4wEL5mb E8JQOTT8a/030WRub9HK+UY7ayy003g50BW8KypxEEL/Cbp1kTXPiOWGXSuRDq5vSnacrOtpLussf 1oSgfWrlEwpWXXp2x6M9a+zM3J6dppdCkTJ+u5+pSs+Cycql3b1Vvk5J7570yWEcXdfFAIRax0dVn ibAu9L9Ih48WZZrdoSlKvmOL5PH5J6VfLW4yy9HIVh07/MLtSLDAK9vKvloayI8xU1XdKyXtmPrqn FnFdfsfb6cGyrrvhYDGLkg1XfFhEU9ksN8mg== Received: from echo-2.prosoft.ural.ru (172.21.245.22) by mx.prosoftsystems.ru (172.21.240.33) with Microsoft SMTP Server (TLS) id 15.1.396.30; Fri, 4 Sep 2026 11:34:51 +0500 Received: from echo-2.prosoft.ural.ru (172.21.245.22) by echo-2.prosoft.ural.ru (172.21.245.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.39; Fri, 4 Sep 2026 11:34:52 +0500 Received: from echo-2.prosoft.ural.ru ([fe80::8f12:4f85:56d8:13ed]) by echo-2.prosoft.ural.ru ([fe80::8f12:4f85:56d8:13ed%17]) with mapi id 15.02.1748.039; Fri, 4 Sep 2026 11:34:52 +0500 From: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= To: Aaro Koskinen CC: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= , Andreas Kemnade , Kevin Hilman , Roger Quadros , "Tony Lindgren" , Lee Jones , Marcin Niestroj , Grygorii Strashko , "linux-omap@vger.kernel.org" , "mfd@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" , "stable@vger.kernel.org" Subject: [PATCH v3 3/3] mfd: tps65217: Use devres for IRQ domain and wake teardown Thread-Topic: [PATCH v3 3/3] mfd: tps65217: Use devres for IRQ domain and wake teardown Thread-Index: AQHdPDd9oXVGJ4sCjkm3Fq1ZVn5vTQ== Date: Fri, 4 Sep 2026 06:34:52 +0000 Message-ID: <20260904063439.69881-4-r.zhambakiev@prosoftsystems.ru> References: <20260904063439.69881-1-r.zhambakiev@prosoftsystems.ru> In-Reply-To: <20260904063439.69881-1-r.zhambakiev@prosoftsystems.ru> Accept-Language: ru-RU, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Radiy Zhambakiev Removing the parent device used to tear the IRQ domain down in tps65217_remove() before the MFD children are unbound: the i2c core only releases the parent's devres after the remove callback returns, whereas devm_mfd_add_devices() registered its own devres action which unbinds the children. Children that requested interrupts from the domain (e.g. tps65217-charger) therefore call free_irq() on virtual IRQs whose descriptors have already been disposed. With CONFIG_SPARSE_IRQ free_irq() then returns early without stopping the threaded handler, leaking the irqaction, the IRQ kthread and a module reference. Register the domain teardown as a devres action right after the domain is created instead. Devres actions are released in reverse order of registration, so the MFD children release their IRQs first, then the parent interrupt is freed and its thread stopped, and only then is the domain torn down. The same ordering covers probe failure, which no longer needs manual cleanup, and the remove callback can be dropped entirely. Balance the enable_irq_wake() in tps65217_irq_init() by registering disable_irq_wake() as a devres action as well. Only do so when enabling actually succeeded, since the parent chip may not support setting wake-up. Fixes: 6556bdacf646fcaa ("mfd: tps65217: Add support for IRQs") Cc: stable@vger.kernel.org Signed-off-by: Radiy Zhambakiev --- drivers/mfd/tps65217.c | 68 +++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index 9a1528456ffc..2d799b60c79b 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -146,6 +146,36 @@ static const struct irq_domain_ops tps65217_irq_domain= _ops =3D { .map =3D tps65217_irq_map, }; =20 +static void tps65217_irq_cleanup(struct tps65217 *tps) +{ + unsigned int virq; + int i; + + if (!tps->irq_domain) + return; + + for (i =3D 0; i < TPS65217_NUM_IRQ; i++) { + virq =3D irq_find_mapping(tps->irq_domain, i); + if (virq) + irq_dispose_mapping(virq); + } + + irq_domain_remove(tps->irq_domain); + tps->irq_domain =3D NULL; +} + +static void tps65217_domain_release(void *data) +{ + struct tps65217 *tps =3D data; + + tps65217_irq_cleanup(tps); +} + +static void tps65217_irq_wake_disable(void *data) +{ + disable_irq_wake((unsigned int)(unsigned long)data); +} + static int tps65217_irq_init(struct tps65217 *tps, int irq) { int ret; @@ -170,6 +200,16 @@ static int tps65217_irq_init(struct tps65217 *tps, int= irq) return -ENOMEM; } =20 + /* + * Devres actions are released in reverse order of registration, + * so the domain is torn down after the parent interrupt and the + * MFD children, which are registered later in probe, have + * released their IRQs. + */ + ret =3D devm_add_action_or_reset(tps->dev, tps65217_domain_release, tps); + if (ret) + return ret; + ret =3D devm_request_threaded_irq(tps->dev, irq, NULL, tps65217_irq_thread, IRQF_ONESHOT, "tps65217-irq", tps); @@ -179,7 +219,16 @@ static int tps65217_irq_init(struct tps65217 *tps, int= irq) return ret; } =20 - enable_irq_wake(irq); + ret =3D enable_irq_wake(irq); + if (ret) { + dev_warn(tps->dev, "failed to enable IRQ wake: %d\n", ret); + } else { + ret =3D devm_add_action_or_reset(tps->dev, + tps65217_irq_wake_disable, + (void *)(unsigned long)irq); + if (ret) + return ret; + } =20 return 0; } @@ -380,22 +429,6 @@ static int tps65217_probe(struct i2c_client *client) return 0; } =20 -static void tps65217_remove(struct i2c_client *client) -{ - struct tps65217 *tps =3D i2c_get_clientdata(client); - unsigned int virq; - int i; - - for (i =3D 0; i < TPS65217_NUM_IRQ; i++) { - virq =3D irq_find_mapping(tps->irq_domain, i); - if (virq) - irq_dispose_mapping(virq); - } - - irq_domain_remove(tps->irq_domain); - tps->irq_domain =3D NULL; -} - static const struct i2c_device_id tps65217_id_table[] =3D { {"tps65217", TPS65217}, { /* sentinel */ } @@ -409,7 +442,6 @@ static struct i2c_driver tps65217_driver =3D { }, .id_table =3D tps65217_id_table, .probe =3D tps65217_probe, - .remove =3D tps65217_remove, }; =20 static int __init tps65217_init(void) --=20 2.55.0