From 20e091c857eff8b7265b7c87dd7c02baaf38491b Mon Sep 17 00:00:00 2001 From: yanyh2 Date: Thu, 12 Oct 2017 12:51:56 +0800 Subject: [PATCH] pwm-qpnp: fix the uninitialized pwm mode issue If the led request the PWM mode and the initial mode is PWM when change the led pwm mode, it will fail to change pwm mode for no mode change with a uninitialized return code and cause the LED configuration failing Change-Id: I29ba3823fb7b4f0d1b2a0d9f22c464c94fbe9717 Signed-off-by: yanyh2 Reviewed-on: https://gerrit.mot.com/1072946 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yeqing Wang Reviewed-by: Coverity Analysis Reviewed-by: Kenneth Kessler Submit-Approved: Jira Key Signed-off-by: Pranav Vashi --- drivers/pwm/pwm-qpnp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-qpnp.c b/drivers/pwm/pwm-qpnp.c index fecec1e2738c..d028b091d813 100644 --- a/drivers/pwm/pwm-qpnp.c +++ b/drivers/pwm/pwm-qpnp.c @@ -2230,8 +2230,10 @@ static int qpnp_parse_dt_config(struct platform_device *pdev, } rc = of_property_read_u32(of_node, "qcom,mode-select", &mode); - if (rc) + if (rc) { + chip->pwm_mode = -EINVAL; goto read_opt_props; + } if (mode > PM_PWM_MODE_LPG || (mode == PM_PWM_MODE_PWM && found_pwm_subnode == 0) ||