diff options
author | Karina Yankevich <k.yankevich@omp.ru> | 2023-09-22 16:59:26 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2023-09-27 10:39:29 +0200 |
commit | 96a35cf6a4e4b15894eb0439205df68af1c0e28b (patch) | |
tree | ab6d92aeb46b44b7f22ba5e091fa68c233654716 /drivers/pinctrl/mediatek | |
parent | 3d855c3f2e1373f40962ea4ab7b97c6a563b52bc (diff) | |
download | lwn-96a35cf6a4e4b15894eb0439205df68af1c0e28b.tar.gz lwn-96a35cf6a4e4b15894eb0439205df68af1c0e28b.zip |
pinctrl: mediatek: moore: handle mtk_hw_set_value() errors in mtk_pinmux_set_mux()
mtk_pinmux_set_mux() doesn't check the result of mtk_hw_set_value()
despite it may return a negative error code. Propagate error code
to caller functions.
Found by Linux Verification Center (linuxtesting.org) with the Svace static
analysis tool.
Signed-off-by: Karina Yankevich <k.yankevich@omp.ru>
Link: https://lore.kernel.org/r/20230922135926.3653428-2-k.yankevich@omp.ru
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/mediatek')
-rw-r--r-- | drivers/pinctrl/mediatek/pinctrl-moore.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c index 8649a2f9d324..889469c7ac26 100644 --- a/drivers/pinctrl/mediatek/pinctrl-moore.c +++ b/drivers/pinctrl/mediatek/pinctrl-moore.c @@ -45,7 +45,7 @@ static int mtk_pinmux_set_mux(struct pinctrl_dev *pctldev, struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev); struct function_desc *func; struct group_desc *grp; - int i; + int i, err; func = pinmux_generic_get_function(pctldev, selector); if (!func) @@ -67,8 +67,11 @@ static int mtk_pinmux_set_mux(struct pinctrl_dev *pctldev, if (!desc->name) return -ENOTSUPP; - mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_MODE, - pin_modes[i]); + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_MODE, + pin_modes[i]); + + if (err) + return err; } return 0; |