pwm: sl28cpld: Set driver data before registering the PWM chip
Subsystems (2)
PATCH 1/1 pwm: sl28cpld: Set driver data before registering the PWM chip
The PWM core code can call back into the PWM chip's implementation at any time after the chip has been registered. Since the driver uses driver data to store contextual information, registration must happen after the driver data has been set.
Reported-by Michael Walle <[email protected]>
Signed-off-by Thierry Reding <[email protected]>
--- drivers/pwm/pwm-sl28cpld.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-sl28cpld.c +2 -2
@@ -230,6 +230,8 @@ static int sl28cpld_pwm_probe(struct platform_device *pdev) chip->base =-1 ; chip->npwm =1 ; +platform_set_drvdata (pdev, priv); + ret =pwmchip_add (&priv->pwm_chip);if (ret) { dev_err(&pdev->dev, "failed to add PWM chip (%pe)",
@@ -237,8 +239,6 @@ static int sl28cpld_pwm_probe(struct platform_device *pdev)return ret; } -platform_set_drvdata (pdev, priv); -return 0 ; }
Signature · 1 line
2.29.2
Quoted 10 lines · Thierry Reding
The PWM core code can call back into the PWM chip's implementation at any time after the chip has been registered. Since the driver uses driver data to store contextual information, registration must happen after the driver data has been set.
Reported-by Michael Walle <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- drivers/pwm/pwm-sl28cpld.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by Lee Jones <[email protected]>
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog