]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
leds: flash: leds-qcom-flash: Fix registry access after re-bind
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Fri, 15 Aug 2025 19:31:27 +0000 (15:31 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:28:40 +0000 (16:28 +0200)
commitc8a1e1f0292158184fa2dd4d8ce3ef9bbbf633e8
tree33b5e39a2a8779513e550c35bff91e3a22847427
parent71230248a71119ad92af975b1f7146e67b267b20
leds: flash: leds-qcom-flash: Fix registry access after re-bind

[ Upstream commit fab15f57360b1e6620a1d0d6b0fbee896e6c1f07 ]

Driver in probe() updates each of 'reg_field' with 'reg_base':

for (i = 0; i < REG_MAX_COUNT; i++)
regs[i].reg += reg_base;

'reg_field' array (under variable 'regs' above) is statically allocated,
thus each re-bind would add another 'reg_base' leading to bogus
register addresses.  Constify the local 'reg_field' array and duplicate
it in probe to solve this.

Fixes: 96a2e242a5dc ("leds: flash: Add driver to support flash LED module in QCOM PMICs")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250529063335.8785-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/leds/flash/leds-qcom-flash.c