UPSTREAM: pwm: Fix pwm_apply_args() call sites
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 17 May 2016 12:27:25 +0000 (14:27 +0200)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 6 Mar 2017 10:28:40 +0000 (18:28 +0800)
commit394b99f37dd199599e383024dc40aa84eec6de3e
tree80473a37b56a388572e38cf2083bd1cfde1476a8
parent55d922eb73a185fef9b89ad758a04db25846c850
UPSTREAM: pwm: Fix pwm_apply_args() call sites

pwm_apply_args() is supposed to initialize a PWM device according to the
arguments provided by the DT or the PWM lookup, but this function was
called inside pwm_device_request(), which in turn was called before the
core had a chance to initialize the pwm->args fields.

Fix that by calling pwm_apply_args directly in pwm_get() and of_pwm_get()
after initializing pwm->args field.

This commit also fixes an invalid pointer dereference introduced by
commit e39c0df1be5a ("pwm: Introduce the pwm_args concept").

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Fixes: e39c0df1be5a ("pwm: Introduce the pwm_args concept")
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit fbd45a12988e75a48d392feb8b0e5feb5d612513)

Change-Id: I9746f4ada57a6cc8155bafe662a63c82338c223a
Signed-off-by: David Wu <david.wu@rock-chips.com>
drivers/pwm/core.c