diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-07-08 03:17:54 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-07-08 03:20:12 +0200 |
commit | 9a932145f2d57bad1092ba006dee9065adc5eb39 (patch) | |
tree | 0ca660b7e0dc96f2d917a860351c5b94782840eb /drivers/input/ff-memless.c | |
parent | Input: synaptics - print firmware ID and board number at init (diff) | |
download | linux-9a932145f2d57bad1092ba006dee9065adc5eb39.tar.xz linux-9a932145f2d57bad1092ba006dee9065adc5eb39.zip |
Input: ff-memless - fix a couple min_t() casts
envelope->attack_level is a u16 type. We're trying to clamp it here
so it's between 0 and 0x7fff. Unfortunately, the cast to __s16 turns
all the values larger than 0x7fff into negative numbers and min_t()
thinks they are less than 0x7fff. envelope_level is an int so now
we've got negative values stored there.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/ff-memless.c')
-rw-r--r-- | drivers/input/ff-memless.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c index 5f558851d646..b107922514fb 100644 --- a/drivers/input/ff-memless.c +++ b/drivers/input/ff-memless.c @@ -176,7 +176,7 @@ static int apply_envelope(struct ml_effect_state *state, int value, value, envelope->attack_level); time_from_level = jiffies_to_msecs(now - state->play_at); time_of_envelope = envelope->attack_length; - envelope_level = min_t(__s16, envelope->attack_level, 0x7fff); + envelope_level = min_t(u16, envelope->attack_level, 0x7fff); } else if (envelope->fade_length && effect->replay.length && time_after(now, @@ -184,7 +184,7 @@ static int apply_envelope(struct ml_effect_state *state, int value, time_before(now, state->stop_at)) { time_from_level = jiffies_to_msecs(state->stop_at - now); time_of_envelope = envelope->fade_length; - envelope_level = min_t(__s16, envelope->fade_level, 0x7fff); + envelope_level = min_t(u16, envelope->fade_level, 0x7fff); } else return value; |