[PATCH] Input: mtk-pmic-keys - fix possible null pointer dereference

Dmitry Torokhov dmitry.torokhov at gmail.com
Tue Apr 29 09:29:40 PDT 2025


On Tue, Apr 29, 2025 at 02:28:15PM +0200, Gary Bisson wrote:
> In mtk_pmic_keys_probe, the regs parameter is only set if the button is
> parsed in the device tree. However, on hardware where the button is left
> floating, that node will most likely be removed not to enable that
> input. In that case the code will try to dereference a null pointer.
> 
> Let's use the regs struct instead as it is defined for all supported
> platforms. Note that it is ok setting the key reg even if that latter is
> disabled as the interrupt won't be enabled anyway.
> 
> Fixes: b581acb49aec5 ("Input: mtk-pmic-keys - transfer per-key bit in
> mtk_pmic_keys_regs")
> 
> Signed-off-by: Gary Bisson <bisson.gary at gmail.com>

Applied, thank you.

-- 
Dmitry



More information about the Linux-mediatek mailing list