diff options
author | Michal Simek <michal.simek@xilinx.com> | 2021-03-12 08:31:34 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2021-03-15 16:38:06 +0100 |
commit | 6a37d750037827d385672acdebf5788fc2ffa633 (patch) | |
tree | 5b05a1d402f7de5235cea08809f6fd1c17189d37 /drivers/pinctrl | |
parent | pinctrl: ti: fix error return code of ti_iodelay_probe() (diff) | |
download | linux-6a37d750037827d385672acdebf5788fc2ffa633.tar.xz linux-6a37d750037827d385672acdebf5788fc2ffa633.zip |
pinctrl: core: Set ret to 0 when group is skipped
Static analyzer tool found that the ret variable is not initialized but
code expects ret value >=0 when pinconf is skipped in the first pinmux
loop. The same expectation is for pinmux in a pinconf loop.
That's why initialize ret to 0 to avoid uninitialized ret value in first
loop or reusing ret value from first loop in second.
Addresses-Coverity: ("Uninitialized variables")
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/e5203bae68eb94b4b8b4e67e5e7b4d86bb989724.1615534291.git.michal.simek@xilinx.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 9063d8f86e60..2252db9bbc3a 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -1266,6 +1266,7 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state) break; case PIN_MAP_TYPE_CONFIGS_PIN: case PIN_MAP_TYPE_CONFIGS_GROUP: + ret = 0; break; default: ret = -EINVAL; @@ -1284,6 +1285,7 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state) list_for_each_entry(setting, &state->settings, node) { switch (setting->type) { case PIN_MAP_TYPE_MUX_GROUP: + ret = 0; break; case PIN_MAP_TYPE_CONFIGS_PIN: case PIN_MAP_TYPE_CONFIGS_GROUP: |