From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-m155101.qiye.163.com (mail-m155101.qiye.163.com [101.71.155.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A7283C2777 for ; Tue, 28 Jul 2026 06:55:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=101.71.155.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785221763; cv=none; b=Pbw1HLdtzfZ3NQEjQgW6YnP/SA4V9TzMN+yE27ie7rDJyFXyPDPjEtBtRuFMnE+/uhXb/2n0ZkKpGeMGXawlQBqKynTegs7pw+oBEOpWvjrmWB2SZtWzW1G8XQ15mmuFzxnFhLaixw1R1FGCMabBQLbuPuac8LHDgu6BhB8pDZ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785221763; c=relaxed/simple; bh=n9PHNvXLa5CJ70gdd+5fY9EIJKXPJpN4SSn2BOxcwBw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lyk9GwIuY2sM2ygDqzp8Y3xvvYcMc/FtlwuNor/3STp5S9NwXpmfd9yOIh3JGcY4W9zeNBFadPVMqSC94229zSLG0C1fboxz6nFfUweHfMIJagKvLnyVOQ7JdNuvv2O2q/9DNOgj1rPUeM19UFKB5lpqJQoKitQ+Apraunpq7i0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn; spf=pass smtp.mailfrom=seu.edu.cn; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b=TC4Xr2kL; arc=none smtp.client-ip=101.71.155.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b="TC4Xr2kL" Received: from LAPTOP-99KJFSET (unknown [222.191.246.242]) by smtp.qiye.163.com (Hmail) with ESMTP id 47d3f7935; Tue, 28 Jul 2026 14:55:56 +0800 (GMT+08:00) From: Hongyan Xu To: Support Opensource , Lee Jones Cc: linux-kernel@vger.kernel.org, jianhao.xu@seu.edu.cn, getshell@seu.edu.cn Subject: [PATCH] mfd: da903x: cancel IRQ work during teardown Date: Tue, 28 Jul 2026 14:55:57 +0800 Message-ID: <20260728065557.1517-1-getshell@seu.edu.cn> X-Mailer: git-send-email 2.50.1.windows.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Tid: 0a9fa782362303a1kunme6e48675e42d4 X-HM-MType: 10 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVkZTUoeVklLTU4YTBkeSEhPQ1YeHw 5VEwETFhoSFyQUDg9ZV1kYEgtZQVlJSUlVSkJKVUlPTVVJT0lZV1kWGg8SFR0UWUFZT0tIVUpLSU hOQ0NVSktLVUtZBg++ DKIM-Signature: a=rsa-sha256; b=TC4Xr2kL5gL2djfgsfndwqY8IKwCumzWe/8kzSJqcAo2gCqJtFGyUbkVg300xQqGaPDsSuhfjzzLMtWr21WlHB82SzkzCHfKuy267SZkusSdWpYch1M7ZAbz1cqt4CkJXmtgPfcC+hudchAlylrirsptyOJeyZzwizgpCrvuVEo=; s=default; c=relaxed/relaxed; d=seu.edu.cn; v=1; bh=aGl33qpg56wQ4B4GaVMVLLOhSSbhrtULoT5vNWhK2e0=; h=date:mime-version:subject:message-id:from; The IRQ handler disables the IRQ and schedules irq_work. Releasing the IRQ does not drain that work, which can continue to use the devm-allocated chip and notifier state. Add a devm action after requesting the IRQ. The action disables the IRQ and cancels the work before automatic IRQ release. Run the same action before removing child devices on normal detach. This issue was found by a static analysis tool. Signed-off-by: Hongyan Xu --- drivers/mfd/da903x.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c index e86b39d..fdff445 100644 --- a/drivers/mfd/da903x.c +++ b/drivers/mfd/da903x.c @@ -421,6 +421,14 @@ static irqreturn_t da903x_irq_handler(int irq, void *data) return IRQ_HANDLED; } +static void da903x_cancel_irq_work(void *data) +{ + struct da903x_chip *chip = data; + + disable_irq(chip->client->irq); + cancel_work_sync(&chip->irq_work); +} + static const struct da903x_chip_ops da903x_ops[] = { [0] = { .init_chip = da9030_init_chip, @@ -529,6 +537,11 @@ static int da903x_probe(struct i2c_client *client) return ret; } + ret = devm_add_action_or_reset(&client->dev, da903x_cancel_irq_work, + chip); + if (ret) + return ret; + return da903x_add_subdevs(chip, pdata); } @@ -536,6 +549,7 @@ static void da903x_remove(struct i2c_client *client) { struct da903x_chip *chip = i2c_get_clientdata(client); + devm_release_action(&client->dev, da903x_cancel_irq_work, chip); da903x_remove_subdevs(chip); } -- 2.50.1.windows.1