aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-sl28cpld.c
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@gmail.com>2020-12-04 13:44:35 +0100
committerThierry Reding <thierry.reding@gmail.com>2020-12-17 14:19:02 +0100
commitedf7f80e780e50bb5711d4c112b721517d0ff73e (patch)
tree7f162a9852f10e845eb165c4d1808cdcf6a6d96a /drivers/pwm/pwm-sl28cpld.c
parentpwm: Remove unused function pwmchip_add_inversed() (diff)
downloadlinux-dev-edf7f80e780e50bb5711d4c112b721517d0ff73e.tar.xz
linux-dev-edf7f80e780e50bb5711d4c112b721517d0ff73e.zip
pwm: sl28cpld: Set driver data before registering the PWM chip
It is good practice to set the driver data before registering a device with a subsystem because the subsystem or the driver core may call back into the driver implementation. This is not currently an issue, but to prevent future changes from causing this to break unexpectedly, make sure that the driver data is set before the PWM chip registration. Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm/pwm-sl28cpld.c')
-rw-r--r--drivers/pwm/pwm-sl28cpld.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-sl28cpld.c b/drivers/pwm/pwm-sl28cpld.c
index 5046b6b7fd35..c5866a2b47b5 100644
--- a/drivers/pwm/pwm-sl28cpld.c
+++ b/drivers/pwm/pwm-sl28cpld.c
@@ -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;
}