ti_sn_pwm_probe() ignored a failure from devm_pm_runtime_enable(). The
helper rolls runtime PM back when action registration fails, but the
probe could then successfully register the PWM chip. A later PWM apply
operation would be unable to resume the auxiliary device.

Propagate the runtime PM setup error before registering the PWM chip.

Fixes: eb3f7cbee294 ("drm/bridge: ti-sn65dsi86: Associate PWM device to 
auxiliary device")
Signed-off-by: Jiawen Liu <[email protected]>
---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c 
b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
index 48b83df9aed61..bbf9491059375 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
@@ -1721,6 +1721,7 @@ static int ti_sn_pwm_probe(struct auxiliary_device *adev,
 {
        struct pwm_chip *chip;
        struct ti_sn65dsi86 *pdata = dev_get_drvdata(adev->dev.parent);
+       int ret;
 
        pdata->pchip = chip = devm_pwmchip_alloc(&adev->dev, 1, 0);
        if (IS_ERR(chip))
@@ -1731,7 +1732,9 @@ static int ti_sn_pwm_probe(struct auxiliary_device *adev,
        chip->ops = &ti_sn_pwm_ops;
        chip->of_xlate = of_pwm_single_xlate;
 
-       devm_pm_runtime_enable(&adev->dev);
+       ret = devm_pm_runtime_enable(&adev->dev);
+       if (ret)
+               return ret;
 
        return pwmchip_add(chip);
 }
-- 
2.34.1

Reply via email to