diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-03-07 22:45:58 -0500 |
---|---|---|
committer | Thierry Reding <thierry.reding@avionic-design.de> | 2013-03-08 02:30:50 -0500 |
commit | 482467ad97b633b28f57c347440d97c108dc4bfb (patch) | |
tree | 78f8dc61214a37283fd88ef13824aff62c131e20 /drivers/pwm/pwm-ab8500.c | |
parent | c791126b93e800c68557483235321b201c082910 (diff) |
pwm: ab8500: use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths more simple.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Diffstat (limited to 'drivers/pwm/pwm-ab8500.c')
-rw-r--r-- | drivers/pwm/pwm-ab8500.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/pwm/pwm-ab8500.c b/drivers/pwm/pwm-ab8500.c index 4248d0418273..93af1bbf88ce 100644 --- a/drivers/pwm/pwm-ab8500.c +++ b/drivers/pwm/pwm-ab8500.c | |||
@@ -99,7 +99,7 @@ static int ab8500_pwm_probe(struct platform_device *pdev) | |||
99 | * Nothing to be done in probe, this is required to get the | 99 | * Nothing to be done in probe, this is required to get the |
100 | * device which is required for ab8500 read and write | 100 | * device which is required for ab8500 read and write |
101 | */ | 101 | */ |
102 | ab8500 = kzalloc(sizeof(*ab8500), GFP_KERNEL); | 102 | ab8500 = devm_kzalloc(&pdev->dev, sizeof(*ab8500), GFP_KERNEL); |
103 | if (ab8500 == NULL) { | 103 | if (ab8500 == NULL) { |
104 | dev_err(&pdev->dev, "failed to allocate memory\n"); | 104 | dev_err(&pdev->dev, "failed to allocate memory\n"); |
105 | return -ENOMEM; | 105 | return -ENOMEM; |
@@ -111,10 +111,8 @@ static int ab8500_pwm_probe(struct platform_device *pdev) | |||
111 | ab8500->chip.npwm = 1; | 111 | ab8500->chip.npwm = 1; |
112 | 112 | ||
113 | err = pwmchip_add(&ab8500->chip); | 113 | err = pwmchip_add(&ab8500->chip); |
114 | if (err < 0) { | 114 | if (err < 0) |
115 | kfree(ab8500); | ||
116 | return err; | 115 | return err; |
117 | } | ||
118 | 116 | ||
119 | dev_dbg(&pdev->dev, "pwm probe successful\n"); | 117 | dev_dbg(&pdev->dev, "pwm probe successful\n"); |
120 | platform_set_drvdata(pdev, ab8500); | 118 | platform_set_drvdata(pdev, ab8500); |
@@ -132,7 +130,6 @@ static int ab8500_pwm_remove(struct platform_device *pdev) | |||
132 | return err; | 130 | return err; |
133 | 131 | ||
134 | dev_dbg(&pdev->dev, "pwm driver removed\n"); | 132 | dev_dbg(&pdev->dev, "pwm driver removed\n"); |
135 | kfree(ab8500); | ||
136 | 133 | ||
137 | return 0; | 134 | return 0; |
138 | } | 135 | } |