Skip to content

Commit 8de4e0f

Browse files
outman119Bartosz Golaszewski
authored andcommitted
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. Fixes: e885002 ("gpio: add QIXIS FPGA GPIO controller") Signed-off-by: Felix Gu <ustc.gu@gmail.com> Link: https://patch.msgid.link/20260320-qixis-v1-1-a8efc22e8945@gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
1 parent ec42a3a commit 8de4e0f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/gpio/gpio-qixis-fpga.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ static int qixis_cpld_gpio_probe(struct platform_device *pdev)
6060
return PTR_ERR(reg);
6161

6262
regmap = devm_regmap_init_mmio(&pdev->dev, reg, &regmap_config_8r_8v);
63-
if (!regmap)
64-
return -ENODEV;
63+
if (IS_ERR(regmap))
64+
return PTR_ERR(regmap);
6565

6666
/* In this case, the offset of our register is 0 inside the
6767
* regmap area that we just created.

0 commit comments

Comments
 (0)