pinctrl: realtek: Fix error handling in probe()
authorDan Carpenter <dan.carpenter@linaro.org>
Thu, 5 Oct 2023 14:01:25 +0000 (17:01 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 6 Oct 2023 21:05:28 +0000 (23:05 +0200)
commit8c58f51ff3c9f2bba5d2d0d01f5561f579e4f485
tree91c38a3653d7c4369c60632d46fbb6aa1ab51865
parent1c0b3cbe7fd98f54fb447e74119216f550a045b9
pinctrl: realtek: Fix error handling in probe()

There are several issues in the probe function:
1) of_iomap() return NULL on error but the code checks for error
   pointers.
2) pinctrl_register() is the reverse.  It returns error pointers
   but the code checks for NULL.
3) The error paths need to call iounmap(data->base) before returning
   to avoid a resource leak.

Fixes: e99ce78030db ("pinctrl: realtek: Add common pinctrl driver for Realtek DHC RTD SoCs")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/590b337a-13ce-4391-a09d-d2b06fbc912d@moroto.mountain
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/realtek/pinctrl-rtd.c