1
0
Fork 0
alistair23-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
..
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
core.c pwm: Fix period and polarity in pwm_get() for non-perfect matches 2014-08-18 10:58:43 +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-tcb: fix max time computation for slow clk source 2013-09-19 14:04:32 +02:00
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: Fill in missing .owner fields 2013-06-12 13:18:29 +02:00
pwm-clps711x.c pwm: Add CLPS711X PWM support 2014-03-18 21:15:16 +01:00
pwm-ep93xx.c pwm: ep93xx: split module author names 2013-12-20 10:53:50 +01:00
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: jz4740: Use devm_clk_get() 2013-12-12 13:23:23 +01:00
pwm-lp3943.c pwm: lp3943: Set pwm_chip can_sleep flag 2014-05-21 12:09:09 +02:00
pwm-lpc32xx.c pwm: lpc32xx: Remove redundant of_match_ptr 2013-10-08 15:49:19 +02:00
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: pca9685: Fix wrong argument to set MODE1_SLEEP bit 2013-06-26 23:23:54 +02:00
pwm-puv3.c pwm: Fill in missing .owner fields 2013-06-12 13:18:29 +02:00
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: davinci: Add Kconfig support for ECAP & EHRPWM devices 2013-03-22 11:35:20 +01:00
pwm-twl-led.c pwm: twl-led: Include linux/of.h header 2013-10-08 15:45:44 +02:00
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 pwm: sysfs: Convert to use ATTRIBUTE_GROUPS macro 2013-12-04 11:35:28 +01:00