--- zzzz-none-000/linux-3.10.107/drivers/iio/gyro/st_gyro_spi.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/iio/gyro/st_gyro_spi.c 2021-02-04 17:41:59.000000000 +0000 @@ -24,27 +24,19 @@ struct st_sensor_data *gdata; int err; - indio_dev = iio_device_alloc(sizeof(*gdata)); - if (indio_dev == NULL) { - err = -ENOMEM; - goto iio_device_alloc_error; - } + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*gdata)); + if (!indio_dev) + return -ENOMEM; gdata = iio_priv(indio_dev); - gdata->dev = &spi->dev; st_sensors_spi_configure(indio_dev, spi, gdata); err = st_gyro_common_probe(indio_dev); if (err < 0) - goto st_gyro_common_probe_error; + return err; return 0; - -st_gyro_common_probe_error: - iio_device_free(indio_dev); -iio_device_alloc_error: - return err; } static int st_gyro_spi_remove(struct spi_device *spi) @@ -68,7 +60,6 @@ static struct spi_driver st_gyro_driver = { .driver = { - .owner = THIS_MODULE, .name = "st-gyro-spi", }, .probe = st_gyro_spi_probe,