From: Fabio Estevam Date: Tue, 3 Sep 2013 00:48:00 +0000 (+0100) Subject: iio: mxs-lradc: Fix the order of resources removal X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a0ef6db7e0d83b8b9d9902c8df2240028d79b275;p=openwrt%2Fstaging%2Fblogic.git iio: mxs-lradc: Fix the order of resources removal Fix the order of resources removal in the error path of mxs_lradc_probe() and also in mxs_lradc_remove(). Signed-off-by: Fabio Estevam Acked-by: Marek Vasut Signed-off-by: Jonathan Cameron --- diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index a08c1736458b..75f5aac11885 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -987,7 +987,7 @@ static int mxs_lradc_probe(struct platform_device *pdev) /* Register the touchscreen input device. */ ret = mxs_lradc_ts_register(lradc); if (ret) - goto err_dev; + goto err_ts_register; /* Register IIO device. */ ret = iio_device_register(iio); @@ -1000,6 +1000,8 @@ static int mxs_lradc_probe(struct platform_device *pdev) err_ts: mxs_lradc_ts_unregister(lradc); +err_ts_register: + mxs_lradc_hw_stop(lradc); err_dev: mxs_lradc_trigger_remove(iio); err_trig: @@ -1012,13 +1014,11 @@ static int mxs_lradc_remove(struct platform_device *pdev) struct iio_dev *iio = platform_get_drvdata(pdev); struct mxs_lradc *lradc = iio_priv(iio); + iio_device_unregister(iio); mxs_lradc_ts_unregister(lradc); - mxs_lradc_hw_stop(lradc); - - iio_device_unregister(iio); - iio_triggered_buffer_cleanup(iio); mxs_lradc_trigger_remove(iio); + iio_triggered_buffer_cleanup(iio); return 0; }