Commit 8dd7e4af authored by Benedikt Niedermayr's avatar Benedikt Niedermayr Committed by Krzysztof Kozlowski

memory: omap-gpmc: fix coverity issue "Control flow issues"

Assign a big positive integer instead of an negative integer to an
u32 variable. Also remove the check for ">= 0" which doesn't make sense
for unsigned integers.
Reported-by: default avatarcoverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527139 ("Control flow issues")
Fixes: 89aed3cd ("memory: omap-gpmc: wait pin additions")
Signed-off-by: default avatarBenedikt Niedermayr <benedikt.niedermayr@siemens.com>
Reviewed-by: default avatarRoger Quadros <rogerq@kernel.org>
Link: https://lore.kernel.org/r/20221109102454.174320-1-benedikt.niedermayr@siemens.comSigned-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
parent 1f1e46b8
...@@ -1045,7 +1045,7 @@ EXPORT_SYMBOL(gpmc_cs_free); ...@@ -1045,7 +1045,7 @@ EXPORT_SYMBOL(gpmc_cs_free);
static bool gpmc_is_valid_waitpin(u32 waitpin) static bool gpmc_is_valid_waitpin(u32 waitpin)
{ {
return waitpin >= 0 && waitpin < gpmc_nr_waitpins; return waitpin < gpmc_nr_waitpins;
} }
static int gpmc_alloc_waitpin(struct gpmc_device *gpmc, static int gpmc_alloc_waitpin(struct gpmc_device *gpmc,
......
...@@ -137,11 +137,11 @@ struct gpmc_device_timings { ...@@ -137,11 +137,11 @@ struct gpmc_device_timings {
#define GPMC_MUX_AD 2 /* Addr-Data multiplex */ #define GPMC_MUX_AD 2 /* Addr-Data multiplex */
/* Wait pin polarity values */ /* Wait pin polarity values */
#define GPMC_WAITPINPOLARITY_INVALID -1 #define GPMC_WAITPINPOLARITY_INVALID UINT_MAX
#define GPMC_WAITPINPOLARITY_ACTIVE_LOW 0 #define GPMC_WAITPINPOLARITY_ACTIVE_LOW 0
#define GPMC_WAITPINPOLARITY_ACTIVE_HIGH 1 #define GPMC_WAITPINPOLARITY_ACTIVE_HIGH 1
#define GPMC_WAITPIN_INVALID -1 #define GPMC_WAITPIN_INVALID UINT_MAX
struct gpmc_settings { struct gpmc_settings {
bool burst_wrap; /* enables wrap bursting */ bool burst_wrap; /* enables wrap bursting */
......
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