gpio: qixis-fpga: Fix error handling for devm_regmap_init_mmio()
PATCH 1/1 gpio: qixis-fpga: Fix error handling for devm_regmap_init_mmio()
devm_regmap_init_mmio() returns an ERR_PTR() on failure, not NULL. The original code checked for NULL which would never trigger on error, potentially leading to an invalid pointer dereference.
Use IS_ERR() and PTR_ERR() to properly handle the error case.
--- drivers/gpio/gpio-qixis-fpga.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-qixis-fpga.c +2 -2
@@ -60,8 +60,8 @@ static int qixis_cpld_gpio_probe(struct platform_device *pdev)return PTR_ERR (reg); regmap =devm_regmap_init_mmio (&pdev->dev, reg, ®map_config_8r_8v); -if (!regmap) -return -ENODEV ; +if (IS_ERR (regmap)) +return PTR_ERR (regmap);/* In this case, the offset of our register is 0 inside the * regmap area that we just created.
---
base-commit: b5d083a3ed1e2798396d5e491432e887da8d4a06
change-id: 20260320-qixis-6abb25dea969
Best regards,
Signature · 1 line
Felix Gu <[email protected]>
Bartosz Golaszewski
AppliedQuoted 6 lines · Felix Gu
devm_regmap_init_mmio()returns anERR_PTR()on failure, not NULL. The original code checked for NULL which would never trigger on error, potentially leading to an invalid pointer dereference.
UseIS_ERR()andPTR_ERR()to properly handle the error case.
Applied, thanks!
[1/1] gpio: qixis-fpga: Fix error handling for devm_regmap_init_mmio()
https://git.kernel.org/brgl/c/8de4e0f44c638c66cdc5eeb4d5ab9acd61c31e4f
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>