From: Benedikt Niedermayr <[email protected]>
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: Benedikt Niedermayr <[email protected]>
Fixes: 8dd7e4af5853 ("memory: omap-gpmc: fix coverity issue "Control flow issues"")
Cc: Rob Herring <[email protected]>
---
drivers/memory/omap-gpmc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 57d9f91fe89b..d78f73db37c8 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -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;
}
--
2.25.1
* B. Niedermayr <[email protected]> [221209 12:32]:
> From: Benedikt Niedermayr <[email protected]>
>
> 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)
> ...
This fixes the issue thanks:
Tested-by: Tony Lindgren <[email protected]>
On 09/12/2022 14:31, B. Niedermayr wrote:
> From: Benedikt Niedermayr <[email protected]>
>
> 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: Benedikt Niedermayr <[email protected]>
> Fixes: 8dd7e4af5853 ("memory: omap-gpmc: fix coverity issue "Control flow issues"")
> Cc: Rob Herring <[email protected]>
Acked-by: Roger Quadros <[email protected]>