diff options
Diffstat (limited to 'drivers/iio/adc/viperboard_adc.c')
-rw-r--r-- | drivers/iio/adc/viperboard_adc.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/iio/adc/viperboard_adc.c b/drivers/iio/adc/viperboard_adc.c index 56ac481c73c0..09727a71e9fa 100644 --- a/drivers/iio/adc/viperboard_adc.c +++ b/drivers/iio/adc/viperboard_adc.c | |||
@@ -124,7 +124,7 @@ static int vprbrd_adc_probe(struct platform_device *pdev) | |||
124 | int ret; | 124 | int ret; |
125 | 125 | ||
126 | /* registering iio */ | 126 | /* registering iio */ |
127 | indio_dev = iio_device_alloc(sizeof(*adc)); | 127 | indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc)); |
128 | if (!indio_dev) { | 128 | if (!indio_dev) { |
129 | dev_err(&pdev->dev, "failed allocating iio device\n"); | 129 | dev_err(&pdev->dev, "failed allocating iio device\n"); |
130 | return -ENOMEM; | 130 | return -ENOMEM; |
@@ -142,16 +142,12 @@ static int vprbrd_adc_probe(struct platform_device *pdev) | |||
142 | ret = iio_device_register(indio_dev); | 142 | ret = iio_device_register(indio_dev); |
143 | if (ret) { | 143 | if (ret) { |
144 | dev_err(&pdev->dev, "could not register iio (adc)"); | 144 | dev_err(&pdev->dev, "could not register iio (adc)"); |
145 | goto error; | 145 | return ret; |
146 | } | 146 | } |
147 | 147 | ||
148 | platform_set_drvdata(pdev, indio_dev); | 148 | platform_set_drvdata(pdev, indio_dev); |
149 | 149 | ||
150 | return 0; | 150 | return 0; |
151 | |||
152 | error: | ||
153 | iio_device_free(indio_dev); | ||
154 | return ret; | ||
155 | } | 151 | } |
156 | 152 | ||
157 | static int vprbrd_adc_remove(struct platform_device *pdev) | 153 | static int vprbrd_adc_remove(struct platform_device *pdev) |
@@ -159,7 +155,6 @@ static int vprbrd_adc_remove(struct platform_device *pdev) | |||
159 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); | 155 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); |
160 | 156 | ||
161 | iio_device_unregister(indio_dev); | 157 | iio_device_unregister(indio_dev); |
162 | iio_device_free(indio_dev); | ||
163 | 158 | ||
164 | return 0; | 159 | return 0; |
165 | } | 160 | } |