Commit 827e0920 authored by Benedikt Niedermayr's avatar Benedikt Niedermayr Committed by Krzysztof Kozlowski

memory: omap-gpmc: fix wait pin validation

This bug has been introduced after switching from -1 to UINT_MAX
for GPMC_WAITPIN_INVALID.

The bug leads to an error when the optional gpmc,wait-pin
dt-property is not used:

...
gpmc_cs_program_settings: invalid wait-pin (-1)
...
Signed-off-by: default avatarBenedikt Niedermayr <benedikt.niedermayr@siemens.com>
Fixes: 8dd7e4af ("memory: omap-gpmc: fix coverity issue "Control flow issues"")
Acked-by: default avatarRoger Quadros <rogerq@kernel.org>
Tested-by: default avatarTony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20221209112828.581491-1-benedikt.niedermayr@siemens.comSigned-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
parent 1b929c02
......@@ -1918,7 +1918,8 @@ int gpmc_cs_program_settings(int cs, struct gpmc_settings *p)
}
}
if (p->wait_pin > gpmc_nr_waitpins) {
if (p->wait_pin != GPMC_WAITPIN_INVALID &&
p->wait_pin > gpmc_nr_waitpins) {
pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin);
return -EINVAL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment