]> Gentwo Git Trees - linux/.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)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Sun, 2 Nov 2025 23:02:32 +0000 (00:02 +0100)
commit1cb053ea2e1dedd8f2d9653b7c3ca5b93c8c9275
treeea967c22769f596fba62242b5c5e094741615e26
parent8ed6b8842c44a4a716dfd536e7f13aff77039a02
power: supply: max77705: Fix potential IRQ chip conflict when probing two devices

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>
drivers/power/supply/max77705_charger.c