linux/drivers/pwm
Geert Uytterhoeven d717ea73e3 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: 3796ce1d4d ("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>
2014-08-18 10:58:43 +02:00
..
core.c pwm: Fix period and polarity in pwm_get() for non-perfect matches 2014-08-18 10:58:43 +02:00
Kconfig pwm: Changes for v3.17-rc1 2014-08-08 18:06:29 -07:00
Makefile pwm: sti: Add new driver for ST's PWM IP 2014-08-07 16:18:27 +02:00
pwm-ab8500.c pwm: ab8500: Fix wrong value shift for disable/enable PWM 2014-05-21 12:29:58 +02:00
pwm-atmel-tcb.c
pwm-atmel.c pwm: atmel: set pwm_chip can_sleep flag 2014-05-21 12:08:57 +02:00
pwm-bcm-kona.c pwm: kona: Introduce Kona PWM controller support 2014-04-28 13:07:44 +02:00
pwm-bfin.c
pwm-clps711x.c
pwm-ep93xx.c
pwm-fsl-ftm.c pwm: fsl-ftm: set pwm_chip can_sleep flag 2014-05-23 09:11:21 +02:00
pwm-imx.c pwm: imx: set can_sleep flag for imx_pwm 2014-08-07 13:22:44 +02:00
pwm-jz4740.c
pwm-lp3943.c pwm: lp3943: Set pwm_chip can_sleep flag 2014-05-21 12:09:09 +02:00
pwm-lpc32xx.c
pwm-lpss.c pwm: lpss: remove dependency on clk framework 2014-08-07 13:18:03 +02:00
pwm-mxs.c pwm: mxs: set pwm_chip can_sleep flag 2014-05-21 12:08:27 +02:00
pwm-pca9685.c
pwm-puv3.c
pwm-pxa.c pwm: pxa: Remove unnecessary OOM messages 2014-04-28 13:37:48 +02:00
pwm-renesas-tpu.c pwm: renesas-tpu: remove unused struct tpu_pwm_platform_data 2014-05-21 11:19:29 +02:00
pwm-rockchip.c pwm: rockchip: Added to support for RK3288 SoC 2014-08-08 13:12:47 +02:00
pwm-samsung.c pwm: samsung: do not set manual update bit in pwm_samsung_config 2014-05-21 12:24:00 +02:00
pwm-spear.c pwm: Changes for v3.16-rc1 2014-06-11 14:06:55 -07:00
pwm-sti.c pwm: sti: Remove PWM period table 2014-08-08 13:12:46 +02:00
pwm-tegra.c pwm: tegra: Remove unnecessary OOM messages 2014-04-28 13:37:48 +02:00
pwm-tiecap.c pwm: pwm-tiecap: Remove unnecessary OOM messages 2014-04-28 13:37:48 +02:00
pwm-tiehrpwm.c pwm: tiehrpwm: inline accessor functions 2014-05-21 11:51:26 +02:00
pwm-tipwmss.c pwm: pwm-tipwmss: remove unnecessary OOM messages 2014-08-07 13:14:33 +02:00
pwm-tipwmss.h
pwm-twl-led.c
pwm-twl.c pwm: twl: Really disable twl6030 PWMs 2014-05-08 23:41:47 +02:00
pwm-vt8500.c pwm: vt8500: Remove unnecessary OOM messages 2014-04-28 13:37:48 +02:00
sysfs.c