@@ -230,8 +230,6 @@ static int audio_iio_aux_probe(struct platform_device *pdev)
230
230
struct audio_iio_aux_chan * iio_aux_chan ;
231
231
struct device * dev = & pdev -> dev ;
232
232
struct audio_iio_aux * iio_aux ;
233
- const char * * names ;
234
- u32 * invert_ranges ;
235
233
int count ;
236
234
int ret ;
237
235
int i ;
@@ -248,22 +246,22 @@ static int audio_iio_aux_probe(struct platform_device *pdev)
248
246
249
247
iio_aux -> num_chans = count ;
250
248
251
- names = kcalloc (iio_aux -> num_chans , sizeof (* names ), GFP_KERNEL );
249
+ const char * * names __free (kfree ) = kcalloc (iio_aux -> num_chans ,
250
+ sizeof (* names ),
251
+ GFP_KERNEL );
252
252
if (!names )
253
253
return - ENOMEM ;
254
254
255
- invert_ranges = kcalloc (iio_aux -> num_chans , sizeof ( * invert_ranges ), GFP_KERNEL );
256
- if (! invert_ranges ) {
257
- ret = - ENOMEM ;
258
- goto out_free_names ;
259
- }
255
+ u32 * invert_ranges __free ( kfree ) = kcalloc (iio_aux -> num_chans ,
256
+ sizeof ( * invert_ranges ),
257
+ GFP_KERNEL ) ;
258
+ if (! invert_ranges )
259
+ return - ENOMEM ;
260
260
261
261
ret = device_property_read_string_array (dev , "io-channel-names" ,
262
262
names , iio_aux -> num_chans );
263
- if (ret < 0 ) {
264
- dev_err_probe (dev , ret , "failed to read io-channel-names\n" );
265
- goto out_free_invert_ranges ;
266
- }
263
+ if (ret < 0 )
264
+ return dev_err_probe (dev , ret , "failed to read io-channel-names\n" );
267
265
268
266
/*
269
267
* snd-control-invert-range is optional and can contain fewer items
@@ -274,10 +272,8 @@ static int audio_iio_aux_probe(struct platform_device *pdev)
274
272
count = min_t (unsigned int , count , iio_aux -> num_chans );
275
273
ret = device_property_read_u32_array (dev , "snd-control-invert-range" ,
276
274
invert_ranges , count );
277
- if (ret < 0 ) {
278
- dev_err_probe (dev , ret , "failed to read snd-control-invert-range\n" );
279
- goto out_free_invert_ranges ;
280
- }
275
+ if (ret < 0 )
276
+ return dev_err_probe (dev , ret , "failed to read snd-control-invert-range\n" );
281
277
}
282
278
283
279
for (i = 0 ; i < iio_aux -> num_chans ; i ++ ) {
@@ -286,23 +282,16 @@ static int audio_iio_aux_probe(struct platform_device *pdev)
286
282
iio_aux_chan -> is_invert_range = invert_ranges [i ];
287
283
288
284
iio_aux_chan -> iio_chan = devm_iio_channel_get (dev , iio_aux_chan -> name );
289
- if (IS_ERR (iio_aux_chan -> iio_chan )) {
290
- ret = PTR_ERR (iio_aux_chan -> iio_chan );
291
- dev_err_probe (dev , ret , "get IIO channel '%s' failed\n" ,
292
- iio_aux_chan -> name );
293
- goto out_free_invert_ranges ;
294
- }
285
+ if (IS_ERR (iio_aux_chan -> iio_chan ))
286
+ return dev_err_probe (dev , PTR_ERR (iio_aux_chan -> iio_chan ),
287
+ "get IIO channel '%s' failed\n" ,
288
+ iio_aux_chan -> name );
295
289
}
296
290
297
291
platform_set_drvdata (pdev , iio_aux );
298
292
299
- ret = devm_snd_soc_register_component (dev , & audio_iio_aux_component_driver ,
300
- NULL , 0 );
301
- out_free_invert_ranges :
302
- kfree (invert_ranges );
303
- out_free_names :
304
- kfree (names );
305
- return ret ;
293
+ return devm_snd_soc_register_component (dev , & audio_iio_aux_component_driver ,
294
+ NULL , 0 );
306
295
}
307
296
308
297
static const struct of_device_id audio_iio_aux_ids [] = {
0 commit comments