@@ -160,24 +160,24 @@ static int pwm_probe(struct platform_device *pdev)
160
160
const struct platform_device_id * id = platform_get_device_id (pdev );
161
161
struct pwm_chip * chip ;
162
162
struct pxa_pwm_chip * pc ;
163
+ struct device * dev = & pdev -> dev ;
163
164
int ret = 0 ;
164
165
165
166
if (IS_ENABLED (CONFIG_OF ) && id == NULL )
166
- id = of_device_get_match_data (& pdev -> dev );
167
+ id = of_device_get_match_data (dev );
167
168
168
169
if (id == NULL )
169
170
return - EINVAL ;
170
171
171
- chip = devm_pwmchip_alloc (& pdev -> dev ,
172
- (id -> driver_data & HAS_SECONDARY_PWM ) ? 2 : 1 ,
172
+ chip = devm_pwmchip_alloc (dev , (id -> driver_data & HAS_SECONDARY_PWM ) ? 2 : 1 ,
173
173
sizeof (* pc ));
174
174
if (IS_ERR (chip ))
175
175
return PTR_ERR (chip );
176
176
pc = to_pxa_pwm_chip (chip );
177
177
178
- pc -> clk = devm_clk_get (& pdev -> dev , NULL );
178
+ pc -> clk = devm_clk_get (dev , NULL );
179
179
if (IS_ERR (pc -> clk ))
180
- return PTR_ERR (pc -> clk );
180
+ return dev_err_probe ( dev , PTR_ERR (pc -> clk ), "Failed to get clock\n" );
181
181
182
182
chip -> ops = & pxa_pwm_ops ;
183
183
@@ -188,11 +188,9 @@ static int pwm_probe(struct platform_device *pdev)
188
188
if (IS_ERR (pc -> mmio_base ))
189
189
return PTR_ERR (pc -> mmio_base );
190
190
191
- ret = devm_pwmchip_add (& pdev -> dev , chip );
192
- if (ret < 0 ) {
193
- dev_err (& pdev -> dev , "pwmchip_add() failed: %d\n" , ret );
194
- return ret ;
195
- }
191
+ ret = devm_pwmchip_add (dev , chip );
192
+ if (ret < 0 )
193
+ return dev_err_probe (dev , ret , "pwmchip_add() failed\n" );
196
194
197
195
return 0 ;
198
196
}
0 commit comments