File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
drivers/staging/iio/frequency Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -367,11 +367,9 @@ static int ad9910_probe(struct spi_device *spi)
367367 struct iio_dev * idev ;
368368 int ret = 0 ;
369369
370- idev = iio_device_alloc (sizeof (* st ));
371- if (idev == NULL ) {
372- ret = - ENOMEM ;
373- goto error_ret ;
374- }
370+ idev = devm_iio_device_alloc (& spi -> dev , sizeof (* st ));
371+ if (!idev )
372+ return - ENOMEM ;
375373 spi_set_drvdata (spi , idev );
376374 st = iio_priv (idev );
377375 mutex_init (& st -> lock );
@@ -383,24 +381,18 @@ static int ad9910_probe(struct spi_device *spi)
383381
384382 ret = iio_device_register (idev );
385383 if (ret )
386- goto error_free_dev ;
384+ return ret ;
387385 spi -> max_speed_hz = 2000000 ;
388386 spi -> mode = SPI_MODE_3 ;
389387 spi -> bits_per_word = 8 ;
390388 spi_setup (spi );
391389 ad9910_init (st );
392390 return 0 ;
393-
394- error_free_dev :
395- iio_device_free (idev );
396- error_ret :
397- return ret ;
398391}
399392
400393static int ad9910_remove (struct spi_device * spi )
401394{
402395 iio_device_unregister (spi_get_drvdata (spi ));
403- iio_device_free (spi_get_drvdata (spi ));
404396
405397 return 0 ;
406398}
You can’t perform that action at this time.
0 commit comments