]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
power: supply: max77705: Fix potential IRQ chip conflict when probing two devices
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Thu, 23 Oct 2025 10:29:06 +0000 (12:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:17:02 +0000 (10:17 +0100)
commit8a241df8cf6d05607ec1b754bd52e7440097a56a
tree49e36d0930c7a630d0999caa80ca096c72e17301
parentc540db17e4afeaf1f4467b76c62b72ac4e2b001b
power: supply: max77705: Fix potential IRQ chip conflict when probing two devices

commit 1cb053ea2e1dedd8f2d9653b7c3ca5b93c8c9275 upstream.

MAX77705 charger is most likely always a single device on the board,
however nothing stops board designers to have two of them, thus same
device driver could probe twice. Or user could manually try to probing
second time.

Device driver is not ready for that case, because it allocates
statically 'struct regmap_irq_chip' as non-const and stores during
probe in 'irq_drv_data' member a pointer to per-probe state
container ('struct max77705_charger_data').  devm_regmap_add_irq_chip()
does not make a copy of 'struct regmap_irq_chip' but stores the pointer.

Second probe - either successful or failure - would overwrite the
'irq_drv_data' from previous device probe, so interrupts would be
executed in a wrong context.

Fixes: a6a494c8e3ce ("power: supply: max77705: Add charger driver for Maxim 77705")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20251023102905.71535-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/power/supply/max77705_charger.c