File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed
drivers/staging/iio/frequency Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -176,11 +176,9 @@ static int ad9951_probe(struct spi_device *spi)
176176 struct iio_dev * idev ;
177177 int ret = 0 ;
178178
179- idev = iio_device_alloc (sizeof (* st ));
180- if (idev == NULL ) {
181- ret = - ENOMEM ;
182- goto error_ret ;
183- }
179+ idev = devm_iio_device_alloc (& spi -> dev , sizeof (* st ));
180+ if (!idev )
181+ return - ENOMEM ;
184182 spi_set_drvdata (spi , idev );
185183 st = iio_priv (idev );
186184 mutex_init (& st -> lock );
@@ -193,25 +191,18 @@ static int ad9951_probe(struct spi_device *spi)
193191
194192 ret = iio_device_register (idev );
195193 if (ret )
196- goto error_free_dev ;
194+ return ret ;
197195 spi -> max_speed_hz = 2000000 ;
198196 spi -> mode = SPI_MODE_3 ;
199197 spi -> bits_per_word = 8 ;
200198 spi_setup (spi );
201199 ad9951_init (st );
202200 return 0 ;
203-
204- error_free_dev :
205- iio_device_free (idev );
206-
207- error_ret :
208- return ret ;
209201}
210202
211203static int ad9951_remove (struct spi_device * spi )
212204{
213205 iio_device_unregister (spi_get_drvdata (spi ));
214- iio_device_free (spi_get_drvdata (spi ));
215206
216207 return 0 ;
217208}
You can’t perform that action at this time.
0 commit comments