From nobody Fri Sep 25 02:44:32 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 205434B4893; Thu, 17 Sep 2026 10:34:11 +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=1789641261; cv=none; b=FsUVkOHPIrPbgO8WcEewKg2loUUx7TEbCnUp8oes9gd4qY3Bk1RolUTcOV3dPAvN7NB9wpticGyTV2p/kz6IqqCAYPZQ6y+nU6UrmW6ACaTDRr2mfNldPnqFeGRON3W9ByqIreH8YFtE1mZRmsh0t8jagD2CxyFUg/dTWcEpwO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789641261; c=relaxed/simple; bh=EDvQQPM4NXFJxheRWHtlfaJepcn9e1uFAUjhCilE6GY=; h=Content-Type:From:To:CC:Subject:Date:Message-ID:References: In-Reply-To:MIME-Version; b=Mvbq3g0291yWDG7HWncydgc0gDOVdrGMjgrPQMugb8/EAkUPI9Szv9P0RT7/b89HegEFoTbRVQWZNWJ9yEx69dcm6sKzfkZNywNPxPD95eThwuMgbgr5YO0GXPlh5T7Hhe1I61c7S5bLMcp3GKKfR2UcwWkNbHmlqfd30rWumgs= 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=jKVXWG/B; 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="jKVXWG/B" 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=1789641234; h=from:to:date:message-id:subject; bh=q5DGoGch0eP9pgkA7a+3UVKIBNQSk0tdO3CJEoh/R8w=; b=jKVXWG/BjNpqvXXGQUJhSAJngKWXTN0sv4ed+tq8GKLS4p/HQbfX9w7Gcmnq39cj+UkUPx20Ylx B/lCaahO/lf4OIc9HTLYoYXBClnNRgsgoix+aqclucuf+bCipJSV5bqCzus+sZ+AerMkj9rUzVEvw BDhTdNwYpeeGl2ACYco6Pp8dlyyTiTJi/mLZfIxJ93cRU3YRKjRF74m9KiZ8IPGnaaINJP1V/m/Rz GKdlHCSqsSxEkZcQ2oxarJJIe9rzcaMlPcnqBFIX+DRwhczLltcP5Hl4Nn2U75Jl5H3mvLSSM2clO OuA9wQMYDH1Wf2ixK9jHcvagZJHcAfxvWU+Q== 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; Thu, 17 Sep 2026 15:33:54 +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; Thu, 17 Sep 2026 15:33:53 +0500 Received: from echo-2.prosoft.ural.ru ([::1]) by echo-2.prosoft.ural.ru ([fe80::c1a2:90f7:8820:c669%17]) with mapi id 15.02.1748.039; Thu, 17 Sep 2026 15:33:53 +0500 From: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= To: Aaro Koskinen CC: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= , Andreas Kemnade , Kevin Hilman , Roger Quadros , "Tony Lindgren" , Lee Jones , Grygorii Strashko , Marcin Niestroj , "linux-omap@vger.kernel.org" , "mfd@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" , "stable@vger.kernel.org" Subject: [PATCH v4 1/3] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure Thread-Topic: [PATCH v4 1/3] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure Thread-Index: AQHdRpAJK/P1oYJB3ES3PIID9fN00g== Date: Thu, 17 Sep 2026 10:33:53 +0000 Message-ID: <20260917103312.92624-2-r.zhambakiev@prosoftsystems.ru> References: <20260917103312.92624-1-r.zhambakiev@prosoftsystems.ru> In-Reply-To: <20260917103312.92624-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.53.0 From nobody Fri Sep 25 02:44:32 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 743974C2264; Thu, 17 Sep 2026 10:34:22 +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=1789641272; cv=none; b=PoPdKTWYYi7/YeXCzT0qr47gA6e8OgEOX6/lw0C0xIqOx4BZ3FTcZyqzXvqiVdfSVhpb/fJc8TH7unYMzDGqYSNcSo6IhXtk/SsVoq7D78l6lKBrE49DLKBqh9T7+VaLiPfOpgOFGZNVnh3ES+kekdlB7W9M/ke/HHBCeMF4ZR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789641272; c=relaxed/simple; bh=SlbmVcyKluXQZa94Vx0faY5/XwBAe7c+q7v4s8ZbJ6M=; h=Content-Type:From:To:CC:Subject:Date:Message-ID:References: In-Reply-To:MIME-Version; b=gL5ZykemFVreX7EURj0yyHWUwRoepE1K4jGDXjyJQaTV0FkXDgoUq9atpYqGtGhSxD1EH1WTqqjGh7Ge9GpVssAZdo9F9rwTY8jBSmqn5kz37Drzy1GQRHKs/UcOdqZg7/tOfKOe2He75iJtmcaK9ETUWOm7fVUk11Xn59AFzCE= 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=GzXg24+i; 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="GzXg24+i" 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=1789641237; h=from:to:date:message-id:subject; bh=9i41YP6YKQ0XrCrYgugZtRgKOBXpPuMajk3GxJ8Jlqc=; b=GzXg24+iquMUWSRemvcSKKPOYL3qUexrHZjhQ1kWDJv3zEW3WnDArFYToqDUh4dUQXWvX7c36xX fvE/TDvSPcVtIn01I/TCV2+14Mr61tHaMPD08pWDLyfXpSGO0JJKj5VnZJxCJgXPRWVHJeZvxkrxI SHvlyh83y0F9AAFrYD6tfEAH+MG5fmvUAbSi301k/LeJBGWfSUPBE4ntTFcbo3o1OXm6TROnxZI3v DURAx6XXjdHMeCgeUBlphBDf3a0OqRlJzEK/JF37nrCl7kvAYkPaOT/9uTOZL4wOqpQfLASvT2F23 +OwZF/dVclkSPcy75zIWCimgSLg+nY3cUYkA== Received: from ECHO-3.prosoft.ural.ru (172.25.100.229) by mx.prosoftsystems.ru (172.21.240.33) with Microsoft SMTP Server (TLS) id 15.1.396.30; Thu, 17 Sep 2026 15:33:56 +0500 Received: from echo-2.prosoft.ural.ru (172.21.245.22) by ECHO-3.prosoft.ural.ru (172.25.100.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.39; Thu, 17 Sep 2026 15:33:56 +0500 Received: from echo-2.prosoft.ural.ru ([::1]) by echo-2.prosoft.ural.ru ([fe80::c1a2:90f7:8820:c669%17]) with mapi id 15.02.1748.039; Thu, 17 Sep 2026 15:33:56 +0500 From: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= To: Aaro Koskinen CC: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= , Andreas Kemnade , Kevin Hilman , Roger Quadros , "Tony Lindgren" , Lee Jones , Grygorii Strashko , Marcin Niestroj , "linux-omap@vger.kernel.org" , "mfd@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" , "stable@vger.kernel.org" Subject: [PATCH v4 2/3] mfd: tps65217: Check return value when masking interrupt sources Thread-Topic: [PATCH v4 2/3] mfd: tps65217: Check return value when masking interrupt sources Thread-Index: AQHdRpAKPZuvbfcdOEiS/29Hcxv2lQ== Date: Thu, 17 Sep 2026 10:33:55 +0000 Message-ID: <20260917103312.92624-3-r.zhambakiev@prosoftsystems.ru> References: <20260917103312.92624-1-r.zhambakiev@prosoftsystems.ru> In-Reply-To: <20260917103312.92624-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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index 2d04d9e0ae29..ee640e3fcf7b 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -155,8 +155,12 @@ 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.53.0 From nobody Fri Sep 25 02:44:32 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 8A7064AD7C9; Thu, 17 Sep 2026 10:34:33 +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=1789641278; cv=none; b=lKzfKhC+XtaoG5kO4PbuBPSl46R8EcDniXOMwbOWGAyHuGUtcjpViDAxzC+zOFlcMvxbcw4Zi1giJj0MHrWjBadnhV3k/OjuIc68WwLwryMVmjH//AHsuFFR5R37t0cgdnbvF6ryqANMPSAmJhZ3vDmQVj4uA3lmcRVw9BmliZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789641278; c=relaxed/simple; bh=CjulAqphr3QccLE5Si2aQ4k+BeaMGpZ4pt84YY9wVpY=; h=Content-Type:From:To:CC:Subject:Date:Message-ID:References: In-Reply-To:MIME-Version; b=Raokcu1A/y3RSpSlOVRwwHjbXwQWnF67/6SizzpluhuCRUDkIldyEt10Uy07l3lUmt6vl2Aub6VDl1z4PJH2P4LMFnd5Fq4S4UsmZyEawXTkgK9lDliFxJvPy0lFQjG5jVHiGOuKQwuoxFlWZOGmbveuQ873VSWvEpB+ohGncS4= 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=BjudiaBi; 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="BjudiaBi" 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=1789641237; h=from:to:date:message-id:subject; bh=F1WUkaPuc7OcBCl/riEUykOHXY8SKxUGXDJDVNpK4WA=; b=BjudiaBiibs6wa7xDHPaTE7TqD8q+x1UIbYDNPgFrqGlywhrXiSVvZW+ZJbjQmo6W8jYzrrLVT4 KB1AkstIcr27zPVl+0zjIYGLgkPwqqKLMDSvRU+y8rw5BcdaSsW1cH1xGahcfQy+lWqP4j5B1cyAT F2qVwIlcjcKolQqB8y01pzt7IbSTxNGarNXG07lQAIp3AUL1vzVbvvwi+irM0iMMtTR+EFsVuHWLD Xq8arqktN0zPSL9qC825DsTyAZpWCC6hYV1Of/Ndpyk14Xz2HkN0HFDCFZQmLaD3hr+yJGF1ZYzxK 3yf9p6gwdWLqQmVjg4VKHr2lPbT8jheLLRdw== Received: from ECHO-3.prosoft.ural.ru (172.25.100.229) by mx.prosoftsystems.ru (172.21.240.33) with Microsoft SMTP Server (TLS) id 15.1.396.30; Thu, 17 Sep 2026 15:33:57 +0500 Received: from echo-2.prosoft.ural.ru (172.21.245.22) by ECHO-3.prosoft.ural.ru (172.25.100.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.39; Thu, 17 Sep 2026 15:33:56 +0500 Received: from echo-2.prosoft.ural.ru ([::1]) by echo-2.prosoft.ural.ru ([fe80::c1a2:90f7:8820:c669%17]) with mapi id 15.02.1748.039; Thu, 17 Sep 2026 15:33:56 +0500 From: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= To: Aaro Koskinen CC: =?koi8-r?B?9sHNwsHLycXXIPLBxMnKIPLJy8HSxMnOz9fJ3g==?= , Andreas Kemnade , Kevin Hilman , Roger Quadros , "Tony Lindgren" , Lee Jones , Grygorii Strashko , Marcin Niestroj , "linux-omap@vger.kernel.org" , "mfd@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" , "stable@vger.kernel.org" Subject: [PATCH v4 3/3] mfd: tps65217: Use devres for IRQ domain and wake teardown Thread-Topic: [PATCH v4 3/3] mfd: tps65217: Use devres for IRQ domain and wake teardown Thread-Index: AQHdRpALdW/uYvvPWkO1pfTnxHniMg== Date: Thu, 17 Sep 2026 10:33:56 +0000 Message-ID: <20260917103312.92624-4-r.zhambakiev@prosoftsystems.ru> References: <20260917103312.92624-1-r.zhambakiev@prosoftsystems.ru> In-Reply-To: <20260917103312.92624-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 | 58 +++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index ee640e3fcf7b..b5138d0f318f 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -146,6 +146,31 @@ static const struct irq_domain_ops tps65217_irq_domain= _ops =3D { .map =3D tps65217_irq_map, }; =20 +static void tps65217_irq_cleanup(void *data) +{ + struct tps65217 *tps =3D data; + unsigned int virq; + + if (!tps->irq_domain) + return; + + for (int 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_irq_wake_disable(void *data) +{ + unsigned long irq =3D (unsigned long)data; + + disable_irq_wake(irq); +} + static int tps65217_irq_init(struct tps65217 *tps, int irq) { int ret; @@ -169,6 +194,10 @@ static int tps65217_irq_init(struct tps65217 *tps, int= irq) return -ENOMEM; } =20 + ret =3D devm_add_action_or_reset(tps->dev, tps65217_irq_cleanup, tps); + if (ret) + return ret; + ret =3D devm_request_threaded_irq(tps->dev, irq, NULL, tps65217_irq_thread, IRQF_ONESHOT, "tps65217-irq", tps); @@ -178,7 +207,17 @@ 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); + return 0; + } + + ret =3D devm_add_action_or_reset(tps->dev, + tps65217_irq_wake_disable, + (void *)(unsigned long)irq); + if (ret) + return ret; =20 return 0; } @@ -379,22 +418,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 */ } @@ -408,7 +431,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.53.0