diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2014-08-13 17:18:53 +0200 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2014-08-18 10:58:43 +0200 |
commit | d717ea73e36dd5659640fae82605ad85c4117f4d (patch) | |
tree | 2711ec749bf955f152b4852a0c4e11eb41726386 /drivers/pwm/pwm-fsl-ftm.c | |
parent | 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9 (diff) | |
download | blackbird-obmc-linux-d717ea73e36dd5659640fae82605ad85c4117f4d.tar.gz blackbird-obmc-linux-d717ea73e36dd5659640fae82605ad85c4117f4d.zip |
pwm: Fix period and polarity in pwm_get() for non-perfect matches
If pwm_get() finds a look-up entry with a perfect match (both dev_id and
con_id match), the loop is aborted, and "p" still points to the correct
struct pwm_lookup.
If only an entry with a matching dev_id or con_id is found, the loop
terminates after traversing the whole list, and "p" now points to
arbitrary memory, not part of the pwm_lookup list.
Then pwm_set_period() and pwm_set_polarity() will set random values for
period resp. polarity.
To fix this, save period and polarity when finding a new best match,
just like is done for chip (for the provider) and index.
This fixes the LCD backlight on r8a7740/armadillo-legacy, which was fed
period 0 and polarity -1068821144 instead of 33333 resp. 1.
Fixes: 3796ce1d4d4b ("pwm: add period and polarity to struct pwm_lookup")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: stable@vger.kernel.org
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm/pwm-fsl-ftm.c')
0 files changed, 0 insertions, 0 deletions