diff mbox series

pinctrl: at91: Add error handling for pinctrl_utils_add_map_mux()

Message ID 20250318030717.781-1-vulab@iscas.ac.cn
State New
Headers show
Series pinctrl: at91: Add error handling for pinctrl_utils_add_map_mux() | expand

Commit Message

Wentao Liang March 18, 2025, 3:07 a.m. UTC
In atmel_pctl_dt_subnode_to_map(), the return value of
pinctrl_utils_add_map_mux() needs to be checked, for the function
will fail to associate group when the group map is full. Add error
handling for pinctrl_utils_add_map_mux() to return immediately and
propagate the error code to caller function when the function fails.

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/pinctrl/pinctrl-at91-pio4.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Linus Walleij April 10, 2025, 10:34 p.m. UTC | #1
On Tue, Mar 18, 2025 at 4:07 AM Wentao Liang <vulab@iscas.ac.cn> wrote:

> In atmel_pctl_dt_subnode_to_map(), the return value of
> pinctrl_utils_add_map_mux() needs to be checked, for the function
> will fail to associate group when the group map is full. Add error
> handling for pinctrl_utils_add_map_mux() to return immediately and
> propagate the error code to caller function when the function fails.
>
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>

Patch applied.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index 8b01d312305a..4dcaebc20d99 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -609,8 +609,10 @@  static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
 		if (ret)
 			goto exit;
 
-		pinctrl_utils_add_map_mux(pctldev, map, reserved_maps, num_maps,
+		ret = pinctrl_utils_add_map_mux(pctldev, map, reserved_maps, num_maps,
 					  group, func);
+		if (ret)
+			goto exit;
 
 		if (num_configs) {
 			ret = pinctrl_utils_add_map_configs(pctldev, map,